diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2018-12-13 20:35:20 +0530 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2018-12-13 22:03:28 +0530 |
commit | f67e933510eec89a30b937b967cdd8965c3658f1 (patch) | |
tree | 0c1e313397424c043cef6548a0761cdccda4fa91 /recipes | |
parent | 065d92fd6079a08d3a91cefde0a49b1155ea1761 (diff) |
bzip2.recipe: Use meson instead of a Makefile
Diffstat (limited to 'recipes')
-rw-r--r-- | recipes/bzip2.recipe | 45 | ||||
-rw-r--r-- | recipes/bzip2/0001-Fix-Makefiles-and-add-support-for-Windows-and-OS-X.patch | 366 | ||||
-rw-r--r-- | recipes/bzip2/add-meson-build-files.patch | 427 |
3 files changed, 430 insertions, 408 deletions
diff --git a/recipes/bzip2.recipe b/recipes/bzip2.recipe index 1d6c8b06..697336df 100644 --- a/recipes/bzip2.recipe +++ b/recipes/bzip2.recipe @@ -1,61 +1,22 @@ # -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python from cerbero.tools.libtool import LibtoolLibrary - class Recipe(recipe.Recipe): name = 'bzip2' version = '1.0.6' licenses = [License.BSD_like] stype = SourceType.TARBALL - # This URL doesn't support https, so we don't use it + btype = BuildType.MESON + # bzip2.org is dead #url = 'https://bzip.org/%(version)s/bzip2-%(version)s.tar.gz' url = 'https://gstreamer.freedesktop.org/src/mirror/bzip2-%(version)s.tar.gz' tarball_checksum = 'a2848f34fcd5d6cf47def00461fcb528a0484d8edef8208d6d2e2909dc61d9cd' - patches = ['bzip2/0001-Fix-Makefiles-and-add-support-for-Windows-and-OS-X.patch'] + patches = ['bzip2/add-meson-build-files.patch'] files_libs = ['libbz2'] files_devel = ['include/bzlib.h'] - - def prepare (self): - self._remove_steps([BuildSteps.CONFIGURE]) - extension = '' - if self.config.target_platform in [Platform.DARWIN, Platform.IOS]: - shared_makefile = 'Makefile-libbz2_dylib' - elif self.config.target_platform == Platform.WINDOWS: - shared_makefile = 'Makefile-libbz2_dll' - extension = '.exe' - else: - shared_makefile = 'Makefile-libbz2_so' - self.make = 'make -f %s; make EXT=%s' % (shared_makefile, extension) - self.make_install = 'make -f %s install PREFIX=%s; make install EXT=%s PREFIX=%s' % \ - (shared_makefile, self.config.prefix, extension, self.config.prefix) - def post_install(self): libtool_la = LibtoolLibrary('bz2', 1, 0, 6, self.config.libdir, self.config.target_platform) libtool_la.save() - src = None - dst = None - dst2 = None - libdir = os.path.join(self.config.prefix, 'lib') - if self.config.target_platform in [Platform.LINUX, Platform.ANDROID]: - src = 'libbz2.so.1.0.6' - dst = 'libbz2.so' - dst2 = 'libbz2.so.1.0' - elif self.config.target_platform == Platform.DARWIN: - src = 'libbz2.1.0.6.dylib' - dst = 'libbz2.dylib' - elif self.config.target_platform == Platform.IOS: - src = 'libbz2.dylib' - dst = 'libbz2.so' - if src and dst: - p = os.path.join(libdir, dst) - if os.path.exists(p) or os.path.islink(p): - os.remove(p) - shell.call('ln -s %s %s' % (src, dst), libdir) - if dst2: - p = os.path.join(libdir, dst2) - if os.path.exists(p) or os.path.islink(p): - os.remove(p) - shell.call('ln -s %s %s' % (src, dst2), libdir) diff --git a/recipes/bzip2/0001-Fix-Makefiles-and-add-support-for-Windows-and-OS-X.patch b/recipes/bzip2/0001-Fix-Makefiles-and-add-support-for-Windows-and-OS-X.patch deleted file mode 100644 index f767660c..00000000 --- a/recipes/bzip2/0001-Fix-Makefiles-and-add-support-for-Windows-and-OS-X.patch +++ /dev/null @@ -1,366 +0,0 @@ -From 9c2bf1de021e082c62c781a25a71406404d548c1 Mon Sep 17 00:00:00 2001 -From: Edward Hervey <edward@centricular.com> -Date: Sat, 10 Mar 2012 19:00:14 +0100 -Subject: [PATCH] Fix Makefiles and add support for Windows and OS X - ---- - Makefile | 64 +++++++++++++++++++++++++----------------- - Makefile-libbz2_dll | 68 ++++++++++++++++++++++++++++++++++++++++++++ - Makefile-libbz2_dylib | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++ - Makefile-libbz2_so | 37 +++++++++++++++++------- - bzip2.c | 2 +- - 5 files changed, 213 insertions(+), 36 deletions(-) - create mode 100644 Makefile-libbz2_dll - create mode 100644 Makefile-libbz2_dylib - -diff --git a/Makefile b/Makefile -index 9754ddf..72dad60 100644 ---- a/Makefile -+++ b/Makefile -@@ -15,13 +15,27 @@ - SHELL=/bin/sh - - # To assist in cross-compiling --CC=gcc --AR=ar --RANLIB=ranlib --LDFLAGS= -+ifndef CC -+ CC=gcc -+endif -+ifndef RANLIB -+ RANLIB=ranlib -+endif -+ifndef AR -+ AR=ar -+endif -+BZIP2_LDFLAGS= - - BIGFILES=-D_FILE_OFFSET_BITS=64 --CFLAGS=-Wall -Winline -O2 -g $(BIGFILES) -+BZIP2_CFLAGS=-Wall -Winline -O2 -g $(BIGFILES) -+ -+ifdef CFLAGS -+BZIP2_CFLAGS+=$(CFLAGS) -+endif -+ -+ifdef LDFLAGS -+BZIP2_LDFLAGS+=$(LDFLAGS) -+endif - - # Where you want it installed when you do 'make install' - PREFIX=/usr/local -@@ -35,13 +49,13 @@ OBJS= blocksort.o \ - decompress.o \ - bzlib.o - --all: libbz2.a bzip2 bzip2recover test -+all: libbz2.a bzip2 bzip2recover - - bzip2: libbz2.a bzip2.o -- $(CC) $(CFLAGS) $(LDFLAGS) -o bzip2 bzip2.o -L. -lbz2 -+ $(CC) $(BZIP2_CFLAGS) $(BZIP2_LDFLAGS) -o bzip2$(EXT) bzip2.o -L. -lbz2 - - bzip2recover: bzip2recover.o -- $(CC) $(CFLAGS) $(LDFLAGS) -o bzip2recover bzip2recover.o -+ $(CC) $(BZIP2_CFLAGS) $(BZIP2_LDFLAGS) -o bzip2recover$(EXT) bzip2recover.o - - libbz2.a: $(OBJS) - rm -f libbz2.a -@@ -75,14 +89,14 @@ install: bzip2 bzip2recover - if ( test ! -d $(PREFIX)/man ) ; then mkdir -p $(PREFIX)/man ; fi - if ( test ! -d $(PREFIX)/man/man1 ) ; then mkdir -p $(PREFIX)/man/man1 ; fi - if ( test ! -d $(PREFIX)/include ) ; then mkdir -p $(PREFIX)/include ; fi -- cp -f bzip2 $(PREFIX)/bin/bzip2 -- cp -f bzip2 $(PREFIX)/bin/bunzip2 -- cp -f bzip2 $(PREFIX)/bin/bzcat -- cp -f bzip2recover $(PREFIX)/bin/bzip2recover -- chmod a+x $(PREFIX)/bin/bzip2 -- chmod a+x $(PREFIX)/bin/bunzip2 -- chmod a+x $(PREFIX)/bin/bzcat -- chmod a+x $(PREFIX)/bin/bzip2recover -+ cp -f bzip2$(EXT) $(PREFIX)/bin/bzip2$(EXT) -+ cp -f bzip2$(EXT) $(PREFIX)/bin/bunzip2$(EXT) -+ cp -f bzip2$(EXT) $(PREFIX)/bin/bzcat$(EXT) -+ cp -f bzip2recover$(EXT) $(PREFIX)/bin/bzip2recover$(EXT) -+ chmod a+x $(PREFIX)/bin/bzip2$(EXT) -+ chmod a+x $(PREFIX)/bin/bunzip2$(EXT) -+ chmod a+x $(PREFIX)/bin/bzcat$(EXT) -+ chmod a+x $(PREFIX)/bin/bzip2recover$(EXT) - cp -f bzip2.1 $(PREFIX)/man/man1 - chmod a+r $(PREFIX)/man/man1/bzip2.1 - cp -f bzlib.h $(PREFIX)/include -@@ -115,23 +129,23 @@ clean: - - blocksort.o: blocksort.c - @cat words0 -- $(CC) $(CFLAGS) -c blocksort.c -+ $(CC) $(BZIP2_CFLAGS) -c blocksort.c - huffman.o: huffman.c -- $(CC) $(CFLAGS) -c huffman.c -+ $(CC) $(BZIP2_CFLAGS) -c huffman.c - crctable.o: crctable.c -- $(CC) $(CFLAGS) -c crctable.c -+ $(CC) $(BZIP2_CFLAGS) -c crctable.c - randtable.o: randtable.c -- $(CC) $(CFLAGS) -c randtable.c -+ $(CC) $(BZIP2_CFLAGS) -c randtable.c - compress.o: compress.c -- $(CC) $(CFLAGS) -c compress.c -+ $(CC) $(BZIP2_CFLAGS) -c compress.c - decompress.o: decompress.c -- $(CC) $(CFLAGS) -c decompress.c -+ $(CC) $(BZIP2_CFLAGS) -c decompress.c - bzlib.o: bzlib.c -- $(CC) $(CFLAGS) -c bzlib.c -+ $(CC) $(BZIP2_CFLAGS) -c bzlib.c - bzip2.o: bzip2.c -- $(CC) $(CFLAGS) -c bzip2.c -+ $(CC) $(BZIP2_CFLAGS) -c bzip2.c - bzip2recover.o: bzip2recover.c -- $(CC) $(CFLAGS) -c bzip2recover.c -+ $(CC) $(BZIP2_CFLAGS) -c bzip2recover.c - - - distclean: clean -diff --git a/Makefile-libbz2_dll b/Makefile-libbz2_dll -new file mode 100644 -index 0000000..e021d31 ---- /dev/null -+++ b/Makefile-libbz2_dll -@@ -0,0 +1,68 @@ -+ -+# This Makefile builds a shared version of the library, -+# libbz2.so.1.0.6, with soname libbz2.so.1.0, -+# at least on x86-Linux (RedHat 7.2), -+# with gcc-2.96 20000731 (Red Hat Linux 7.1 2.96-98). -+# Please see the README file for some important info -+# about building the library like this. -+ -+# ------------------------------------------------------------------ -+# This file is part of bzip2/libbzip2, a program and library for -+# lossless, block-sorting data compression. -+# -+# bzip2/libbzip2 version 1.0.6 of 6 September 2010 -+# Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org> -+# -+# Please read the WARNING, DISCLAIMER and PATENTS sections in the -+# README file. -+# -+# This program is released under the terms of the license contained -+# in the file LICENSE. -+# ------------------------------------------------------------------ -+ -+ -+SHELL=/bin/sh -+BIGFILES=-D_FILE_OFFSET_BITS=64 -+BZIP2_CFLAGS=-fpic -fPIC -Wall -Winline -O2 -g $(BIGFILES) -+BZIP2_LDFLAGS= -+ -+ifdef CFLAGS -+BZIP2_CFLAGS+=$(CFLAGS) -+endif -+ -+ifdef LDFLAGS -+BZIP2_LDFLAGS+=$(LDFLAGS) -+endif -+ -+OBJS= blocksort.o \ -+ huffman.o \ -+ crctable.o \ -+ randtable.o \ -+ compress.o \ -+ decompress.o \ -+ bzlib.o -+ -+all: $(OBJS) -+ $(CC) $(BZIP2_LDFLAGS) -shared -o libbz2.dll -Wl,--out-implib,libbz2.dll.a $(OBJS) -+ -+clean: -+ rm -f $(OBJS) libbz2.dll -+ -+install: -+ cp -f libbz2.dll $(PREFIX)/bin -+ cp -f libbz2.dll.a $(PREFIX)/lib -+ -+blocksort.o: blocksort.c -+ $(CC) $(BZIP2_CFLAGS) -c blocksort.c -+huffman.o: huffman.c -+ $(CC) $(BZIP2_CFLAGS) -c huffman.c -+crctable.o: crctable.c -+ $(CC) $(BZIP2_CFLAGS) -c crctable.c -+randtable.o: randtable.c -+ $(CC) $(BZIP2_CFLAGS) -c randtable.c -+compress.o: compress.c -+ $(CC) $(BZIP2_CFLAGS) -c compress.c -+decompress.o: decompress.c -+ $(CC) $(BZIP2_CFLAGS) -c decompress.c -+bzlib.o: bzlib.c -+ $(CC) $(BZIP2_CFLAGS) -c bzlib.c -diff --git a/Makefile-libbz2_dylib b/Makefile-libbz2_dylib -new file mode 100644 -index 0000000..cd77e3a ---- /dev/null -+++ b/Makefile-libbz2_dylib -@@ -0,0 +1,78 @@ -+ -+# This Makefile builds a shared version of the library, -+# libbz2.so.1.0.6, with soname libbz2.so.1.0, -+# at least on x86-Linux (RedHat 7.2), -+# with gcc-2.96 20000731 (Red Hat Linux 7.1 2.96-98). -+# Please see the README file for some important info -+# about building the library like this. -+ -+# ------------------------------------------------------------------ -+# This file is part of bzip2/libbzip2, a program and library for -+# lossless, block-sorting data compression. -+# -+# bzip2/libbzip2 version 1.0.6 of 6 September 2010 -+# Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org> -+# -+# Please read the WARNING, DISCLAIMER and PATENTS sections in the -+# README file. -+# -+# This program is released under the terms of the license contained -+# in the file LICENSE. -+# ------------------------------------------------------------------ -+ -+ -+SHELL=/bin/sh -+ifndef CC -+CC=gcc -+endif -+BIGFILES=-D_FILE_OFFSET_BITS=64 -+BZIP2_CFLAGS=-fpic -fPIC -Wall -Winline -O2 -g $(BIGFILES) -+BZIP2_LDFLAGS= -+ -+ifdef CFLAGS -+BZIP2_CFLAGS+=$(CFLAGS) -+endif -+ -+ifdef LDFLAGS -+BZIP2_LDFLAGS+=$(LDFLAGS) -+endif -+ -+OBJS= blocksort.o \ -+ huffman.o \ -+ crctable.o \ -+ randtable.o \ -+ compress.o \ -+ decompress.o \ -+ bzlib.o -+ -+all: $(OBJS) -+ $(CC) $(BZIP2_LDFLAGS) -shared -Wl,-install_name -Wl,libbz2.1.0.dylib -o libbz2.1.0.6.dylib $(OBJS) -+ rm -f libbz2.1.0.dylib -+ rm -f libbz2.dylib -+ ln -s libbz2.1.0.6.dylib libbz2.1.0.dylib -+ ln -s libbz2.1.0.6.dylib libbz2.dylib -+ -+clean: -+ rm -f $(OBJS) libbz2.1.0.6.dylib libbz2.1.0.dylib libbz2.dylib -+ -+install: -+ cp -f libbz2.1.0.6.dylib $(PREFIX)/lib -+ rm -f $(PREFIX)/lib/libbz2.1.0.dylib -+ rm -f $(PREFIX)/lib/libbz2.dylib -+ cp -R libbz2.1.0.dylib $(PREFIX)/lib/ -+ cp -R libbz2.dylib $(PREFIX)/lib/ -+ -+blocksort.o: blocksort.c -+ $(CC) $(BZIP2_CFLAGS) -c blocksort.c -+huffman.o: huffman.c -+ $(CC) $(BZIP2_CFLAGS) -c huffman.c -+crctable.o: crctable.c -+ $(CC) $(BZIP2_CFLAGS) -c crctable.c -+randtable.o: randtable.c -+ $(CC) $(BZIP2_CFLAGS) -c randtable.c -+compress.o: compress.c -+ $(CC) $(BZIP2_CFLAGS) -c compress.c -+decompress.o: decompress.c -+ $(CC) $(BZIP2_CFLAGS) -c decompress.c -+bzlib.o: bzlib.c -+ $(CC) $(BZIP2_CFLAGS) -c bzlib.c -diff --git a/Makefile-libbz2_so b/Makefile-libbz2_so -index e58791b..bb0dca5 100644 ---- a/Makefile-libbz2_so -+++ b/Makefile-libbz2_so -@@ -22,9 +22,22 @@ - - - SHELL=/bin/sh -+ -+ifndef CC - CC=gcc -+endif -+ - BIGFILES=-D_FILE_OFFSET_BITS=64 --CFLAGS=-fpic -fPIC -Wall -Winline -O2 -g $(BIGFILES) -+BZIP2_CFLAGS=-fpic -fPIC -Wall -Winline -O2 -g $(BIGFILES) -+BZIP2_LDFLAGS= -+ -+ifdef CFLAGS -+BZIP2_CFLAGS+=$(CFLAGS) -+endif -+ -+ifdef LDFLAGS -+BZIP2_LDFLAGS+=$(LDFLAGS) -+endif - - OBJS= blocksort.o \ - huffman.o \ -@@ -35,25 +48,29 @@ OBJS= blocksort.o \ - bzlib.o - - all: $(OBJS) -- $(CC) -shared -Wl,-soname -Wl,libbz2.so.1.0 -o libbz2.so.1.0.6 $(OBJS) -- $(CC) $(CFLAGS) -o bzip2-shared bzip2.c libbz2.so.1.0.6 -+ $(CC) $(BZIP2_LDFLAGS) -shared -Wl,-soname -Wl,libbz2.so.1.0 -o libbz2.so.1.0.6 $(OBJS) -+ $(CC) $(BZIP2_CFLAGS) $(BZIP2_LDFLAGS) -o bzip2-shared bzip2.c libbz2.so.1.0.6 - rm -f libbz2.so.1.0 - ln -s libbz2.so.1.0.6 libbz2.so.1.0 - - clean: - rm -f $(OBJS) bzip2.o libbz2.so.1.0.6 libbz2.so.1.0 bzip2-shared - -+install: -+ cp -f libbz2.so.1.0.6 $(PREFIX)/lib -+ ln -s $(PREFIX)/lib/libbz2.so.1.0.6 $(PREFIX)/lib/libbz2.so.1.0 -+ - blocksort.o: blocksort.c -- $(CC) $(CFLAGS) -c blocksort.c -+ $(CC) $(BZIP2_CFLAGS) -c blocksort.c - huffman.o: huffman.c -- $(CC) $(CFLAGS) -c huffman.c -+ $(CC) $(BZIP2_CFLAGS) -c huffman.c - crctable.o: crctable.c -- $(CC) $(CFLAGS) -c crctable.c -+ $(CC) $(BZIP2_CFLAGS) -c crctable.c - randtable.o: randtable.c -- $(CC) $(CFLAGS) -c randtable.c -+ $(CC) $(BZIP2_CFLAGS) -c randtable.c - compress.o: compress.c -- $(CC) $(CFLAGS) -c compress.c -+ $(CC) $(BZIP2_CFLAGS) -c compress.c - decompress.o: decompress.c -- $(CC) $(CFLAGS) -c decompress.c -+ $(CC) $(BZIP2_CFLAGS) -c decompress.c - bzlib.o: bzlib.c -- $(CC) $(CFLAGS) -c bzlib.c -+ $(CC) $(BZIP2_CFLAGS) -c bzlib.c -diff --git a/bzip2.c b/bzip2.c -index 6de9d1d..dc626a4 100644 ---- a/bzip2.c -+++ b/bzip2.c -@@ -128,7 +128,7 @@ - #if BZ_LCCWIN32 - # include <io.h> - # include <fcntl.h> --# include <sys\stat.h> -+# include <sys/stat.h> - - # define NORETURN /**/ - # define PATH_SEP '\\' --- -2.14.3 - diff --git a/recipes/bzip2/add-meson-build-files.patch b/recipes/bzip2/add-meson-build-files.patch new file mode 100644 index 00000000..a6d46916 --- /dev/null +++ b/recipes/bzip2/add-meson-build-files.patch @@ -0,0 +1,427 @@ +From 42f2a11dbe251cea54844a987ca0e0715b1d8ca9 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= <tim@centricular.com> +Date: Fri, 15 Apr 2016 11:24:29 +0100 +Subject: [PATCH 1/9] bzlib.h: don't use WINAPI and add + __declspec(dllexport/dllimport) + +windows.h does #define WINAPI __stdcall but we want +the __cdecl ABI. Causes linking problems on 32-bit +windows otherwise when consumed by MSVC. + +Also sprinkle explicit dllexport/dllimport which will be +needed if compiled with MSVC (mingw exports all symbols +by default, but MSVC doesn't). +--- + bzlib.h | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/bzlib.h b/bzlib.h +index 8277123..219a94f 100644 +--- a/bzlib.h ++++ b/bzlib.h +@@ -82,12 +82,12 @@ typedef + # undef small + # endif + # ifdef BZ_EXPORT +-# define BZ_API(func) WINAPI func +-# define BZ_EXTERN extern ++# define BZ_API(func) func ++# define BZ_EXTERN __declspec(dllexport) extern + # else + /* import windows dll dynamically */ +-# define BZ_API(func) (WINAPI * func) +-# define BZ_EXTERN ++# define BZ_API(func) ( * func) ++# define BZ_EXTERN __declspec(dllimport) extern + # endif + #else + # define BZ_API(func) func +-- +2.19.1 + + +From 1543a0a9fafc58ea2548cfbbb382f2672703159d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= <tim@centricular.com> +Date: Fri, 15 Apr 2016 11:26:43 +0100 +Subject: [PATCH 2/9] meson: add meson build for bz2 + +--- + meson.build | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 77 insertions(+) + create mode 100644 meson.build + +diff --git a/meson.build b/meson.build +new file mode 100644 +index 0000000..7f70507 +--- /dev/null ++++ b/meson.build +@@ -0,0 +1,77 @@ ++project('bzip2', 'c', version : '1.0.6') ++ ++bzip2_sources = [ ++ 'blocksort.c', ++ 'huffman.c', ++ 'crctable.c', ++ 'randtable.c', ++ 'compress.c', ++ 'decompress.c', ++ 'bzlib.c' ++] ++ ++libversion = meson.project_version() ++soversion = '1.0' ++ ++bz2_c_args = ['-D_FILE_OFFSET_BITS=64'] ++ ++cc = meson.get_compiler('c') ++if cc.get_id() == 'gcc' or cc.get_id() == 'clang' ++ # bzip2.c:557: warning: variable nread set but not used ++ bz2_c_args += ['-Wno-unused-but-set-variable'] ++endif ++ ++bz2_incs = include_directories('.') ++ ++install_headers(['bzlib.h']) ++ ++libtype = 'both' # FIXME: make option ++ ++if libtype != 'shared' ++ libbz2_shared = shared_library('bz2', bzip2_sources, ++ version : libversion, ++ soversion : soversion, ++ c_args : bz2_c_args, ++ include_directories : bz2_incs, ++ install : true, ++# dependencies : mathlib, ++# vs_module_defs: vs_module_defs_dir + 'libbz2.def', ++ ) ++ libbz2 = libbz2_shared ++endif ++ ++if libtype != 'static' ++ libbz2_static = static_library('bz2', bzip2_sources, ++ c_args : bz2_c_args, ++ include_directories : bz2_incs, ++ install : true, ++# dependencies : mathlib, ++ ) ++ libbz2 = libbz2_static ++endif ++ ++bz2_dep = declare_dependency(link_with : libbz2, include_directories : bz2_incs) ++ ++executable('bzip2', 'bzip2.c', ++ install : true, ++ dependencies : bz2_dep, ++ c_args: bz2_c_args) ++ ++executable('bunzip2', 'bzip2.c', ++ install : true, ++ dependencies : bz2_dep, ++ c_args: bz2_c_args) ++ ++executable('bzcat', 'bzip2.c', ++ install : true, ++ dependencies : bz2_dep, ++ c_args: bz2_c_args) ++ ++executable('bzip2recover', 'bzip2recover.c', ++ install : true, ++ c_args: bz2_c_args) ++ ++install_man('bzdiff.1', 'bzgrep.1', 'bzip2.1', 'bzmore.1') ++install_data('bzgrep', 'bzmore', 'bzdiff', install_dir : 'bin') ++ ++# FIXME: build docs +-- +2.19.1 + + +From 7e5370733be5a318b862a65667cfe63cd9873791 Mon Sep 17 00:00:00 2001 +From: Nirbheek Chauhan <nirbheek@centricular.com> +Date: Fri, 17 Jun 2016 15:55:36 +0530 +Subject: [PATCH 3/9] bzlib.h: Don't need to #include windows.h anymore + +We no longer use the WINAPI macro +--- + bzlib.h | 5 ----- + 1 file changed, 5 deletions(-) + +diff --git a/bzlib.h b/bzlib.h +index 219a94f..955baf4 100644 +--- a/bzlib.h ++++ b/bzlib.h +@@ -76,11 +76,6 @@ typedef + #endif + + #ifdef _WIN32 +-# include <windows.h> +-# ifdef small +- /* windows.h define small to char */ +-# undef small +-# endif + # ifdef BZ_EXPORT + # define BZ_API(func) func + # define BZ_EXTERN __declspec(dllexport) extern +-- +2.19.1 + + +From 07d00c5c16ff44800b8737c7d948d2d9beb057a8 Mon Sep 17 00:00:00 2001 +From: Nirbheek Chauhan <nirbheek@centricular.com> +Date: Fri, 17 Jun 2016 15:57:54 +0530 +Subject: [PATCH 4/9] bzlib.h: Don't use dllimport/dllexport when + BZ_STATIC_COMPILATION is defined + +This allows code to see the correct prototypes for linking to the static +library on Windows. Without this, it'll try to link to the static +library with indirections required for accessing symbols in a DLL and +fail to find those symbols. +--- + bzlib.h | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/bzlib.h b/bzlib.h +index 955baf4..acc6bf8 100644 +--- a/bzlib.h ++++ b/bzlib.h +@@ -75,7 +75,8 @@ typedef + #include <stdio.h> + #endif + +-#ifdef _WIN32 ++/* Define BZ_STATIC_COMPILATION if linking to libbz2 statically */ ++#if defined(_WIN32) && !defined(BZ_STATIC_COMPILATION) + # ifdef BZ_EXPORT + # define BZ_API(func) func + # define BZ_EXTERN __declspec(dllexport) extern +-- +2.19.1 + + +From bcc6bbdb93c5591945ddd4c499f49c6caf56e474 Mon Sep 17 00:00:00 2001 +From: Nirbheek Chauhan <nirbheek@centricular.com> +Date: Fri, 17 Jun 2016 15:59:11 +0530 +Subject: [PATCH 5/9] meson: soversion should be an unsigned integer + +Either as an integer, or as a string containing an integer +--- + meson.build | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/meson.build b/meson.build +index 7f70507..8146535 100644 +--- a/meson.build ++++ b/meson.build +@@ -11,7 +11,7 @@ bzip2_sources = [ + ] + + libversion = meson.project_version() +-soversion = '1.0' ++soversion = '1' + + bz2_c_args = ['-D_FILE_OFFSET_BITS=64'] + +-- +2.19.1 + + +From 14306fd5a9c3f12cb7c36af6c8b4719234586540 Mon Sep 17 00:00:00 2001 +From: Nirbheek Chauhan <nirbheek@centricular.com> +Date: Fri, 17 Jun 2016 16:00:21 +0530 +Subject: [PATCH 6/9] meson: Ignore warnings about 'insecure functions' that + are used everywhere by bz2 + +--- + meson.build | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/meson.build b/meson.build +index 8146535..bc333c5 100644 +--- a/meson.build ++++ b/meson.build +@@ -19,6 +19,9 @@ cc = meson.get_compiler('c') + if cc.get_id() == 'gcc' or cc.get_id() == 'clang' + # bzip2.c:557: warning: variable nread set but not used + bz2_c_args += ['-Wno-unused-but-set-variable'] ++elif cc.get_id() == 'msvc' ++ # Ignore C4996 about "insecure functions" ++ bz2_c_args += ['/wd4996'] + endif + + bz2_incs = include_directories('.') +-- +2.19.1 + + +From 25bbfc99440c0a6183aa8a6f367391716b7b4e50 Mon Sep 17 00:00:00 2001 +From: Nirbheek Chauhan <nirbheek@centricular.com> +Date: Thu, 13 Dec 2018 20:19:18 +0530 +Subject: [PATCH 7/9] Update to latest meson, fix MSVC support, etc. + +--- + meson.build | 61 ++++++++++++++++++++++++----------------------------- + 1 file changed, 27 insertions(+), 34 deletions(-) + +diff --git a/meson.build b/meson.build +index bc333c5..c2cb942 100644 +--- a/meson.build ++++ b/meson.build +@@ -1,4 +1,4 @@ +-project('bzip2', 'c', version : '1.0.6') ++project('bzip2', 'c', version : '1.0.6', meson_version : '>=0.49') + + bzip2_sources = [ + 'blocksort.c', +@@ -10,50 +10,42 @@ bzip2_sources = [ + 'bzlib.c' + ] + +-libversion = meson.project_version() +-soversion = '1' +- +-bz2_c_args = ['-D_FILE_OFFSET_BITS=64'] ++bz2_c_args = [] + + cc = meson.get_compiler('c') +-if cc.get_id() == 'gcc' or cc.get_id() == 'clang' +- # bzip2.c:557: warning: variable nread set but not used +- bz2_c_args += ['-Wno-unused-but-set-variable'] +-elif cc.get_id() == 'msvc' ++if cc.get_id() == 'msvc' + # Ignore C4996 about "insecure functions" + bz2_c_args += ['/wd4996'] ++else ++ # bzip2.c:557: warning: variable nread set but not used ++ bz2_c_args += ['-Wno-unused-but-set-variable'] + endif + + bz2_incs = include_directories('.') + + install_headers(['bzlib.h']) + +-libtype = 'both' # FIXME: make option +- +-if libtype != 'shared' +- libbz2_shared = shared_library('bz2', bzip2_sources, +- version : libversion, +- soversion : soversion, +- c_args : bz2_c_args, +- include_directories : bz2_incs, +- install : true, +-# dependencies : mathlib, +-# vs_module_defs: vs_module_defs_dir + 'libbz2.def', +- ) +- libbz2 = libbz2_shared +-endif +- +-if libtype != 'static' +- libbz2_static = static_library('bz2', bzip2_sources, +- c_args : bz2_c_args, +- include_directories : bz2_incs, +- install : true, +-# dependencies : mathlib, +- ) +- libbz2 = libbz2_static ++# libbz2 is unversioned on Windows ++libkwargs = {} ++if host_machine.system() != 'windows' ++ libkwargs = {'version': meson.project_version()} + endif + +-bz2_dep = declare_dependency(link_with : libbz2, include_directories : bz2_incs) ++libbz2 = library('bz2', bzip2_sources, ++ c_args : bz2_c_args, ++ include_directories : bz2_incs, ++ install : true, ++ vs_module_defs : 'libbz2.def', ++ kwargs : libkwargs, ++) ++ ++bz2_dep = declare_dependency(link_with : libbz2, ++ include_directories : bz2_incs) ++pkg = import('pkgconfig') ++pkg.generate(name: 'bzip2', ++ description: 'bzip2 data compression library', ++ version: meson.project_version(), ++ libraries: libbz2) + + executable('bzip2', 'bzip2.c', + install : true, +@@ -75,6 +67,7 @@ executable('bzip2recover', 'bzip2recover.c', + c_args: bz2_c_args) + + install_man('bzdiff.1', 'bzgrep.1', 'bzip2.1', 'bzmore.1') +-install_data('bzgrep', 'bzmore', 'bzdiff', install_dir : 'bin') ++install_data('bzgrep', 'bzmore', 'bzdiff', install_dir : 'bin', ++ install_mode : 'rwxr-xr-x') + + # FIXME: build docs +-- +2.19.1 + + +From 96d60e1713e1ca30d472d043ccb9e1b4e15d2be9 Mon Sep 17 00:00:00 2001 +From: Nirbheek Chauhan <nirbheek@centricular.com> +Date: Thu, 13 Dec 2018 20:22:55 +0530 +Subject: [PATCH 8/9] Don't use __declspec(dllimport/export) for symbol + exporting + +This partially reverts commit 42f2a11dbe251cea54844a987ca0e0715b1d8ca9. + +We can just use the .def file, which also has the advantage of not +needing to build object files twice: once for shared and once for +static. +--- + bzlib.h | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) + +diff --git a/bzlib.h b/bzlib.h +index acc6bf8..8a0363d 100644 +--- a/bzlib.h ++++ b/bzlib.h +@@ -75,15 +75,14 @@ typedef + #include <stdio.h> + #endif + +-/* Define BZ_STATIC_COMPILATION if linking to libbz2 statically */ +-#if defined(_WIN32) && !defined(BZ_STATIC_COMPILATION) ++#if defined(_WIN32) + # ifdef BZ_EXPORT + # define BZ_API(func) func +-# define BZ_EXTERN __declspec(dllexport) extern ++# define BZ_EXTERN extern + # else + /* import windows dll dynamically */ + # define BZ_API(func) ( * func) +-# define BZ_EXTERN __declspec(dllimport) extern ++# define BZ_EXTERN + # endif + #else + # define BZ_API(func) func +-- +2.19.1 + + +From c13f8250377ae78357528770ce87cc35c4a2fae3 Mon Sep 17 00:00:00 2001 +From: Nirbheek Chauhan <nirbheek@centricular.com> +Date: Thu, 13 Dec 2018 20:26:34 +0530 +Subject: [PATCH 9/9] libbz2.def: Don't encode the library name + +With MSVC we output bz2.dll, not libbz2.dll +--- + libbz2.def | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/libbz2.def b/libbz2.def +index 2dc0dd8..6e4ddf6 100644 +--- a/libbz2.def ++++ b/libbz2.def +@@ -1,4 +1,3 @@ +-LIBRARY LIBBZ2
+ DESCRIPTION "libbzip2: library for data compression"
+ EXPORTS
+ BZ2_bzCompressInit
+-- +2.19.1 + |