2
0

00-base-templates.conf 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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. lflags =>
  70. sub {
  71. my @libs = ();
  72. push(@libs, "-L".$withargs{zlib_lib}) if $withargs{zlib_lib};
  73. push(@libs, "-L".$withargs{brotli_lib}) if $withargs{brotli_lib};
  74. push(@libs, "-L".$withargs{zstd_lib}) if $withargs{zstd_lib};
  75. return join(" ", @libs);
  76. },
  77. ex_libs =>
  78. sub {
  79. my @libs = ();
  80. push(@libs, "-lz") if !defined($disabled{zlib}) && defined($disabled{"zlib-dynamic"});
  81. if (!defined($disabled{brotli}) && defined($disabled{"brotli-dynamic"})) {
  82. push(@libs, "-lbrotlienc");
  83. push(@libs, "-lbrotlidec");
  84. push(@libs, "-lbrotlicommon");
  85. push(@libs, "-lm");
  86. }
  87. push(@libs, "-lzstd") if !defined($disabled{zstd}) && defined($disabled{"zstd-dynamic"});
  88. return join(" ", @libs);
  89. },
  90. HASHBANGPERL => "/usr/bin/env perl", # Only Unix actually cares
  91. RANLIB => sub { which("$config{cross_compile_prefix}ranlib")
  92. ? "ranlib" : "" },
  93. RC => "windres",
  94. build_scheme => [ "unified", "unix" ],
  95. build_file => "Makefile",
  96. perl_platform => 'Unix',
  97. },
  98. BASE_Windows => {
  99. inherit_from => [ "BASE_common" ],
  100. template => 1,
  101. lib_defines =>
  102. sub {
  103. my @defs = ();
  104. unless ($disabled{"zlib-dynamic"}) {
  105. my $zlib = $withargs{zlib_lib} // "ZLIB1";
  106. push @defs, 'LIBZ=' . (quotify("perl", $zlib))[0];
  107. }
  108. return [ @defs ];
  109. },
  110. ex_libs =>
  111. sub {
  112. my @libs = ();
  113. unless ($disabled{zlib}) {
  114. if (defined($disabled{"zlib-dynamic"})) {
  115. push(@libs, $withargs{zlib_lib} // "ZLIB1");
  116. }
  117. }
  118. unless ($disabled{zstd}) {
  119. if (defined($disabled{"zstd-dynamic"})) {
  120. push(@libs, $withargs{zstd_lib} // "libzstd");
  121. }
  122. }
  123. unless ($disabled{brotli}) {
  124. if (defined($disabled{"brotli-dynamic"})) {
  125. my $path = "";
  126. if (defined($withargs{brotli_lib})) {
  127. $path = $withargs{brotli_lib} . "\\";
  128. }
  129. push(@libs, $path . "brotlicommon.lib");
  130. push(@libs, $path . "brotlidec.lib");
  131. push(@libs, $path . "brotlienc.lib");
  132. }
  133. }
  134. return join(" ", @libs);
  135. },
  136. MT => "mt",
  137. MTFLAGS => "-nologo",
  138. mtinflag => "-manifest ",
  139. mtoutflag => "-outputresource:",
  140. build_file => "makefile",
  141. build_scheme => [ "unified", "windows" ],
  142. perl_platform => 'Windows',
  143. },
  144. BASE_VMS => {
  145. inherit_from => [ "BASE_common" ],
  146. template => 1,
  147. includes =>
  148. add(sub {
  149. my @incs = ();
  150. # GNV$ZLIB_INCLUDE is the standard logical name for later
  151. # zlib incarnations.
  152. push @incs, 'GNV$ZLIB_INCLUDE:'
  153. if !$disabled{zlib} && !$withargs{zlib_include};
  154. return [ @incs ];
  155. }),
  156. build_file => "descrip.mms",
  157. build_scheme => [ "unified", "VMS" ],
  158. perl_platform => 'VMS',
  159. },
  160. );