summaryrefslogtreecommitdiff
path: root/libz/libz/buildfile
diff options
context:
space:
mode:
Diffstat (limited to 'libz/libz/buildfile')
-rw-r--r--libz/libz/buildfile99
1 files changed, 99 insertions, 0 deletions
diff --git a/libz/libz/buildfile b/libz/libz/buildfile
new file mode 100644
index 0000000..0eb118f
--- /dev/null
+++ b/libz/libz/buildfile
@@ -0,0 +1,99 @@
+# file : libz/buildfile
+# copyright : Copyright (c) 2018-2019 Code Synthesis Ltd
+# license : zlib License; see accompanying LICENSE file
+
+lib{z}: {h c}{*} {def}{zlib} {file}{zlib.map}
+
+tclass = $c.target.class
+tsys = $c.target.system
+
+windows = ($tclass == 'windows')
+
+# Include the generated config header into the distribution (so that we don't
+# pick up an installed one) and don't remove it when cleaning in src (so that
+# clean results in a state identical to distributed).
+#
+h{zconf}: in{zconf}
+{
+ dist = true
+ clean = ($src_root != $out_root)
+
+ in.symbol = '@'
+ in.substitution = lax
+
+ HAVE_UNISTD_H = ($windows ? 0 : 1)
+ HAVE_STDARG_H = ($windows ? 0 : 1)
+}
+
+# Build options.
+#
+if! $windows
+ c.poptions += -DHAVE_HIDDEN
+
+switch $tclass, $tsys
+{
+ case 'linux' | 'bsd'
+ c.poptions += -D_LARGEFILE64_SOURCE=1
+
+ case 'windows', 'win32-msvc'
+ c.poptions += -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE
+}
+
+# Note that we add "-I$src_base" for the headers auto-generating machinery to
+# work properly.
+#
+c.poptions =+ "-I$out_base" "-I$src_base"
+
+switch $c.class, $tsys
+{
+ case 'gcc'
+ {
+ # Disable warnings that pop up with -Wall -Wextra. Upstream doesn't seem
+ # to care about these and it is not easy to disable specific warnings in a
+ # way that works across compilers/version (some -Wno-* options are only
+ # recognized in newer versions).
+ #
+ c.coptions += -Wno-all -Wno-extra
+
+ # Disable the Clang targeting MSVC warnings.
+ #
+ if ($c.id == 'clang' && $tsys == 'win32-msvc')
+ c.coptions += -Wno-deprecated-declarations
+ }
+ case 'msvc'
+ {
+ # Disable warnings that pop up with /W3.
+ #
+ c.coptions += /wd4267
+ }
+}
+
+switch $tclass
+{
+ case 'linux' | 'bsd'
+ {
+ # Make sure all symbols are resolvable.
+ #
+ c.loptions += -Wl,--no-undefined
+
+ c.loptions += "-Wl,--version-script=$src_base/zlib.map"
+ }
+}
+
+# Export options.
+#
+lib{z}: cc.export.poptions = "-I$out_base" "-I$src_base"
+
+# See bootstrap.build for details.
+#
+if $version.pre_release
+ lib{z}: bin.lib.version = @"-$version.project_id"
+else
+ lib{z}: bin.lib.version = @"-$abi_version_major" linux@"$abi_version"
+
+# Install the bare minimum of headers (note: not recreating subdirectories).
+#
+h{*}: install = false
+
+for h: zconf zlib
+ h{$h}@./: install = include/