00-base-templates.conf 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. # -*- Mode: perl -*-
  2. my %targets=(
  3. DEFAULTS => {
  4. template => 1,
  5. cflags => "",
  6. cppflags => "",
  7. lflags => "",
  8. defines => [],
  9. includes => [],
  10. lib_cflags => "",
  11. lib_cppflags => "",
  12. lib_defines => [],
  13. thread_scheme => "(unknown)", # Assume we don't know
  14. thread_defines => [],
  15. unistd => "<unistd.h>",
  16. shared_target => "",
  17. shared_cflag => "",
  18. shared_defines => [],
  19. shared_ldflag => "",
  20. shared_rcflag => "",
  21. #### Defaults for the benefit of the config targets who don't inherit
  22. #### a BASE and assume Unix defaults
  23. #### THESE WILL DISAPPEAR IN OpenSSL 1.2
  24. build_scheme => [ "unified", "unix" ],
  25. build_file => "Makefile",
  26. AR => "(unused)",
  27. ARFLAGS => "(unused)",
  28. CC => "cc",
  29. HASHBANGPERL => "/usr/bin/env perl",
  30. RANLIB => sub { which("$config{cross_compile_prefix}ranlib")
  31. ? "ranlib" : "" },
  32. RC => "windres",
  33. #### THESE WILL BE ENABLED IN OpenSSL 1.2
  34. #HASHBANGPERL => "PERL", # Only Unix actually cares
  35. },
  36. BASE_common => {
  37. template => 1,
  38. enable => [],
  39. disable => [],
  40. defines =>
  41. sub {
  42. my @defs = ( 'OPENSSL_BUILDING_OPENSSL' );
  43. push @defs, "BROTLI" unless $disabled{brotli};
  44. push @defs, "BROTLI_SHARED" unless $disabled{"brotli-dynamic"};
  45. push @defs, "ZLIB" unless $disabled{zlib};
  46. push @defs, "ZLIB_SHARED" unless $disabled{"zlib-dynamic"};
  47. push @defs, "ZSTD" unless $disabled{zstd};
  48. push @defs, "ZSTD_SHARED" unless $disabled{"zstd-dynamic"};
  49. return [ @defs ];
  50. },
  51. includes =>
  52. sub {
  53. my @incs = ();
  54. push @incs, $withargs{brotli_include}
  55. if !$disabled{brotli} && $withargs{brotli_include};
  56. push @incs, $withargs{zlib_include}
  57. if !$disabled{zlib} && $withargs{zlib_include};
  58. push @incs, $withargs{zstd_include}
  59. if !$disabled{zstd} && $withargs{zstd_include};
  60. return [ @incs ];
  61. },
  62. },
  63. BASE_unix => {
  64. inherit_from => [ "BASE_common" ],
  65. template => 1,
  66. AR => "ar",
  67. ARFLAGS => "qc",
  68. CC => "cc",
  69. bin_cflags =>
  70. sub {
  71. my @flags = ();
  72. if (!defined($disabled{pie})) {
  73. push(@flags, "-fPIE");
  74. }
  75. return join(" ", @flags);
  76. },
  77. bin_lflags =>
  78. sub {
  79. my @flags = ();
  80. if (!defined($disabled{pie})) {
  81. push(@flags, "-pie");
  82. }
  83. return join(" ", @flags);
  84. },
  85. lflags =>
  86. sub {
  87. my @libs = ();
  88. push(@libs, "-L".$withargs{zlib_lib}) if $withargs{zlib_lib};
  89. push(@libs, "-L".$withargs{brotli_lib}) if $withargs{brotli_lib};
  90. push(@libs, "-L".$withargs{zstd_lib}) if $withargs{zstd_lib};
  91. return join(" ", @libs);
  92. },
  93. ex_libs =>
  94. sub {
  95. my @libs = ();
  96. push(@libs, "-lz") if !defined($disabled{zlib}) && defined($disabled{"zlib-dynamic"});
  97. if (!defined($disabled{brotli}) && defined($disabled{"brotli-dynamic"})) {
  98. push(@libs, "-lbrotlienc");
  99. push(@libs, "-lbrotlidec");
  100. push(@libs, "-lbrotlicommon");
  101. push(@libs, "-lm");
  102. }
  103. push(@libs, "-lzstd") if !defined($disabled{zstd}) && defined($disabled{"zstd-dynamic"});
  104. return join(" ", @libs);
  105. },
  106. HASHBANGPERL => "/usr/bin/env perl", # Only Unix actually cares
  107. RANLIB => sub { which("$config{cross_compile_prefix}ranlib")
  108. ? "ranlib" : "" },
  109. RC => "windres",
  110. build_scheme => [ "unified", "unix" ],
  111. build_file => "Makefile",
  112. perl_platform => 'Unix',
  113. },
  114. BASE_Windows => {
  115. inherit_from => [ "BASE_common" ],
  116. template => 1,
  117. lib_defines =>
  118. sub {
  119. my @defs = ();
  120. unless ($disabled{"zlib-dynamic"}) {
  121. my $zlib = $withargs{zlib_lib} // "ZLIB1";
  122. push @defs, 'LIBZ=' . (quotify("perl", $zlib))[0];
  123. }
  124. return [ @defs ];
  125. },
  126. ex_libs =>
  127. sub {
  128. my @libs = ();
  129. unless ($disabled{zlib}) {
  130. if (defined($disabled{"zlib-dynamic"})) {
  131. push(@libs, $withargs{zlib_lib} // "ZLIB1");
  132. }
  133. }
  134. unless ($disabled{zstd}) {
  135. if (defined($disabled{"zstd-dynamic"})) {
  136. push(@libs, $withargs{zstd_lib} // "libzstd");
  137. }
  138. }
  139. unless ($disabled{brotli}) {
  140. if (defined($disabled{"brotli-dynamic"})) {
  141. my $path = "";
  142. if (defined($withargs{brotli_lib})) {
  143. $path = $withargs{brotli_lib} . "\\";
  144. }
  145. push(@libs, $path . "brotlicommon.lib");
  146. push(@libs, $path . "brotlidec.lib");
  147. push(@libs, $path . "brotlienc.lib");
  148. }
  149. }
  150. return join(" ", @libs);
  151. },
  152. MT => "mt",
  153. MTFLAGS => "-nologo",
  154. mtinflag => "-manifest ",
  155. mtoutflag => "-outputresource:",
  156. build_file => "makefile",
  157. build_scheme => [ "unified", "windows" ],
  158. perl_platform => 'Windows',
  159. },
  160. BASE_VMS => {
  161. inherit_from => [ "BASE_common" ],
  162. template => 1,
  163. includes =>
  164. add(sub {
  165. my @incs = ();
  166. # GNV$ZLIB_INCLUDE is the standard logical name for later
  167. # zlib incarnations.
  168. push @incs, 'GNV$ZLIB_INCLUDE:'
  169. if !$disabled{zlib} && !$withargs{zlib_include};
  170. return [ @incs ];
  171. }),
  172. build_file => "descrip.mms",
  173. build_scheme => [ "unified", "VMS" ],
  174. perl_platform => 'VMS',
  175. },
  176. );