From cb2762360fc6edb6afe52759550979ce5068b9b0 Mon Sep 17 00:00:00 2001 From: David Tardon Date: Fri, 26 Oct 2012 15:33:26 +0200 Subject: gbuildify zlib Change-Id: I702c044fdf510c67364f2fc32889ca394583edf6 --- Makefile.top | 2 +- RepositoryExternal.mk | 27 ++++++++++++++-- config_host.mk.in | 1 + configure.ac | 2 ++ zlib/ExternalPackage_zlib.mk | 17 ++++++++++ zlib/Makefile | 14 ++++++++ zlib/Module_zlib.mk | 28 ++++++++++++++++ zlib/StaticLibrary_zlib.mk | 28 ++++++++++++++++ zlib/StaticLibrary_zlib_x64.mk | 35 ++++++++++++++++++++ zlib/UnpackedTarball_zlib.mk | 19 +++++++++++ zlib/make_patched_header.pl | 66 -------------------------------------- zlib/makefile.mk | 73 ------------------------------------------ zlib/prj/d.lst | 11 ------- zlib/prj/dmake | 0 zlib/zlib-dmakebuild.patch | 68 --------------------------------------- 15 files changed, 170 insertions(+), 221 deletions(-) create mode 100644 zlib/ExternalPackage_zlib.mk create mode 100644 zlib/Makefile create mode 100644 zlib/Module_zlib.mk create mode 100644 zlib/StaticLibrary_zlib.mk create mode 100644 zlib/StaticLibrary_zlib_x64.mk create mode 100644 zlib/UnpackedTarball_zlib.mk delete mode 100755 zlib/make_patched_header.pl delete mode 100644 zlib/makefile.mk delete mode 100644 zlib/prj/dmake delete mode 100644 zlib/zlib-dmakebuild.patch diff --git a/Makefile.top b/Makefile.top index f2894123168d..6df40945ec15 100644 --- a/Makefile.top +++ b/Makefile.top @@ -203,6 +203,7 @@ xmlreader\ xmlscript\ xmlsecurity\ xsltml\ +zlib\ dmake_modules:=\ berkeleydb\ @@ -247,7 +248,6 @@ setup_native\ stlport\ sysui\ xpdf\ -zlib\ export gb_TAILBUILDTARGET=all slowcheck diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk index 83d90ad5701e..e08beecc9e4d 100644 --- a/RepositoryExternal.mk +++ b/RepositoryExternal.mk @@ -167,23 +167,46 @@ $(call gb_LinkTarget_add_libs,$(1),-lz) endef +# nothing on system +define gb_LinkTarget__use_zlib_x64 + +endef + else # !SYSTEM_ZLIB $(eval $(call gb_Helper_register_static_libraries,PLAINLIBS, \ zlib \ + zlib_x64 \ )) -define gb_LinkTarget__use_zlib +define gb_LinkTarget__use_zlib_multiarch +$(if $(2),,$(call gb_Output_error,gb_LinkTarget__use_zlib_multiarch needs two arguments)) + +$(call gb_LinkTarget_use_packages,$(1),\ + zlib_inc \ +) + $(call gb_LinkTarget_set_include,$(1),\ -I$(OUTDIR)/inc/external/zlib \ $$(INCLUDE) \ ) + $(call gb_LinkTarget_use_static_libraries,$(1),\ - zlib \ + $(2) \ ) endef +define gb_LinkTarget__use_zlib +$(call gb_LinkTarget__use_zlib_multiarch,$(1),zlib) + +endef + +define gb_LinkTarget__use_zlib_x64 +$(call gb_LinkTarget__use_zlib_multiarch,$(1),zlib_x64) + +endef + endif # SYSTEM_ZLIB diff --git a/config_host.mk.in b/config_host.mk.in index 1f9793f83faf..fc348b326616 100644 --- a/config_host.mk.in +++ b/config_host.mk.in @@ -705,3 +705,4 @@ export XSLTML_TARBALL=@XSLTML_TARBALL@ export XSLTPROC=@XSLTPROC@ export ZLIB_CFLAGS=@ZLIB_CFLAGS@ export ZLIB_LIBS=@ZLIB_LIBS@ +export ZLIB_TARBALL=@ZLIB_TARBALL@ diff --git a/configure.ac b/configure.ac index 5f5671b47656..0556a9a5d296 100644 --- a/configure.ac +++ b/configure.ac @@ -6837,12 +6837,14 @@ else BUILD_TYPE="$BUILD_TYPE ZLIB" ZLIB_CFLAGS="-I${OUTDIR}/inc/external/zlib" ZLIB_LIBS="-L${OUTDIR}/lib -lz" + ZLIB_TARBALL="2ab442d169156f34c379c968f3f482dd-zlib-1.2.7.tar.bz2" fi AC_SUBST(ZLIB_CFLAGS) AC_SUBST(ZLIB_LIBS) AC_SUBST(SYSTEM_ZLIB) AC_SUBST([SYSTEM_MINIZIP]) AC_SUBST([MINGW_MINIZIP_DLL]) +AC_SUBST(ZLIB_TARBALL) dnl =================================================================== dnl Check for system jpeg diff --git a/zlib/ExternalPackage_zlib.mk b/zlib/ExternalPackage_zlib.mk new file mode 100644 index 000000000000..15571a1f4fef --- /dev/null +++ b/zlib/ExternalPackage_zlib.mk @@ -0,0 +1,17 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_ExternalPackage_ExternalPackage,zlib_inc,zlib)) + +$(eval $(call gb_ExternalPackage_add_unpacked_files,zlib_inc,inc/external/zlib,\ + zconf.h \ + zlib.h \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/zlib/Makefile b/zlib/Makefile new file mode 100644 index 000000000000..0997e628485b --- /dev/null +++ b/zlib/Makefile @@ -0,0 +1,14 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST)))) + +include $(module_directory)/../solenv/gbuild/partial_build.mk + +# vim: set noet sw=4 ts=4: diff --git a/zlib/Module_zlib.mk b/zlib/Module_zlib.mk new file mode 100644 index 000000000000..446e07edc24c --- /dev/null +++ b/zlib/Module_zlib.mk @@ -0,0 +1,28 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +ifneq ($(SYSTEM_ZLIB),YES) + +$(eval $(call gb_Module_Module,zlib)) + +$(eval $(call gb_Module_add_targets,zlib,\ + ExternalPackage_zlib \ + StaticLibrary_zlib \ + UnpackedTarball_zlib \ +)) + +ifeq ($(BUILD_X64),TRUE) +$(eval $(call gb_Module_add_targets,zlib,\ + StaticLibrary_zlib_x64 \ +)) +endif + +endif + +# vim: set noet sw=4 ts=4: diff --git a/zlib/StaticLibrary_zlib.mk b/zlib/StaticLibrary_zlib.mk new file mode 100644 index 000000000000..69e7017db63f --- /dev/null +++ b/zlib/StaticLibrary_zlib.mk @@ -0,0 +1,28 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_StaticLibrary_StaticLibrary,zlib)) + +$(eval $(call gb_StaticLibrary_use_unpacked,zlib,zlib)) + +$(eval $(call gb_StaticLibrary_set_warnings_not_errors,zlib)) + +$(eval $(call gb_StaticLibrary_add_generated_cobjects,zlib,\ + UnpackedTarball/zlib/adler32 \ + UnpackedTarball/zlib/compress \ + UnpackedTarball/zlib/crc32 \ + UnpackedTarball/zlib/deflate \ + UnpackedTarball/zlib/inffast \ + UnpackedTarball/zlib/inflate \ + UnpackedTarball/zlib/inftrees \ + UnpackedTarball/zlib/trees \ + UnpackedTarball/zlib/zutil \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/zlib/StaticLibrary_zlib_x64.mk b/zlib/StaticLibrary_zlib_x64.mk new file mode 100644 index 000000000000..cd250054bd39 --- /dev/null +++ b/zlib/StaticLibrary_zlib_x64.mk @@ -0,0 +1,35 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_StaticLibrary_StaticLibrary,zlib_x64)) + +$(eval $(call gb_StaticLibrary_set_x64,zlib,YES)) + +$(eval $(call gb_StaticLibrary_use_unpacked,zlib_x64,zlib)) + +$(eval $(call gb_StaticLibrary_set_warnings_not_errors,zlib_x64)) + +$(eval $(call gb_StaticLibrary_set_include,zlib_x64,\ + -I$(call gb_UnpackedTarball_get_dir,zlib) \ + $$(INCLUDE) \ +)) + +$(eval $(call gb_StaticLibrary_add_x64_generated_cobjects,zlib_x64,\ + UnpackedTarball/zlib/x64/adler32 \ + UnpackedTarball/zlib/x64/compress \ + UnpackedTarball/zlib/x64/crc32 \ + UnpackedTarball/zlib/x64/deflate \ + UnpackedTarball/zlib/x64/inffast \ + UnpackedTarball/zlib/x64/inflate \ + UnpackedTarball/zlib/x64/inftrees \ + UnpackedTarball/zlib/x64/trees \ + UnpackedTarball/zlib/x64/zutil \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/zlib/UnpackedTarball_zlib.mk b/zlib/UnpackedTarball_zlib.mk new file mode 100644 index 000000000000..fa476b918b7c --- /dev/null +++ b/zlib/UnpackedTarball_zlib.mk @@ -0,0 +1,19 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_UnpackedTarball_UnpackedTarball,zlib)) + +$(eval $(call gb_UnpackedTarball_set_tarball,zlib,$(ZLIB_TARBALL))) + +$(eval $(call gb_UnpackedTarball_set_post_action,zlib,\ + mkdir -p x64 && \ + cp $(addsuffix .c,adler32 compress crc32 deflate inffast inflate inftrees trees zutil) x64 \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/zlib/make_patched_header.pl b/zlib/make_patched_header.pl deleted file mode 100755 index 41dbdc5fbb96..000000000000 --- a/zlib/make_patched_header.pl +++ /dev/null @@ -1,66 +0,0 @@ -: -eval 'exec perl -S $0 ${1+"$@"}' - if 0; -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* -# -# make_patched_header - make patched header -# - -use strict; -use File::Basename; -use File::Path; -use Carp; - -my $patched_file = shift @ARGV; -$patched_file =~ s/\\/\//g; -my $module = shift @ARGV; -my $patch_dir = dirname($patched_file); -my $orig_file = $patched_file; -$orig_file =~ s/\/patched\//\//; - -if (!-f $orig_file) { carp("Cannot find file $orig_file\n"); }; -if (!-d $patch_dir) { - mkpath($patch_dir, 0, 0775); - if (!-d $patch_dir) {("mkdir: could not create directory $patch_dir\n"); }; -}; - -open(PATCHED_FILE, ">$patched_file") or carp("Cannot open file $patched_file\n"); -open(ORIG_FILE, "<$orig_file") or carp("Cannot open file $orig_file\n"); -foreach () { - if (/#include\s*"(\w+\.h\w*)"/) { - my $include = $1; - s/#include "$include"/#include <$module\/$include>/g; - }; - print PATCHED_FILE $_; -}; -close PATCHED_FILE; -close ORIG_FILE; - -exit(0); - - diff --git a/zlib/makefile.mk b/zlib/makefile.mk deleted file mode 100644 index 7a677e50cdb2..000000000000 --- a/zlib/makefile.mk +++ /dev/null @@ -1,73 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=. - -PRJNAME=zlib -TARGET=zlib - -.IF "$(GUI)" == "UNX" -.IF "$(SYSTEM_ZLIB)" == "YES" -all: - @echo "An already available installation of zlib should exist on your system." - @echo "Therefore the version provided here does not need to be built in addition." -.ENDIF -.ENDIF - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -# --- Files -------------------------------------------------------- - -TARFILE_NAME=zlib-1.2.7 -TARFILE_MD5=2ab442d169156f34c379c968f3f482dd - -PATCH_FILES=zlib-dmakebuild.patch -ADDITIONAL_FILES=makefile.mk - -#relative to CONFIGURE_DIR - -BUILD_DIR=$(CONFIGURE_DIR) -BUILD_ACTION=dmake $(MFLAGS) $(CALLMACROS) - -OUT2INC= \ - zlib.h \ - zconf.h - -PATCHED_HEADERS=$(INCCOM)$/patched$/zlib.h - -# --- Targets ------------------------------------------------------ - -.INCLUDE : set_ext.mk -.INCLUDE : target.mk -.INCLUDE : tg_ext.mk - -ALLTAR: $(PATCHED_HEADERS) - -$(PATCHED_HEADERS) : $(PACKAGE_DIR)$/$(PREDELIVER_FLAG_FILE) - @$(PERL) make_patched_header.pl $@ $(PRJNAME) diff --git a/zlib/prj/d.lst b/zlib/prj/d.lst index ef40caf49c44..e69de29bb2d1 100644 --- a/zlib/prj/d.lst +++ b/zlib/prj/d.lst @@ -1,11 +0,0 @@ -mkdir: %_DEST%\inc\external\zlib -mkdir: %_DEST%\lib\x64 - -..\%__SRC%\inc\patched\zlib.h %_DEST%\inc\external\zlib\zlib.h -..\%__SRC%\inc\zconf.h %_DEST%\inc\external\zlib\zconf.h - -..\%__SRC%\lib\libzlib.a %_DEST%\lib\libzlib.a -..\%__SRC%\slb\zlib.lib %_DEST%\lib\zlib.lib -..\%__SRC%\slb\zlib.lin %_DEST%\lib\zlib.lin -..\%__SRC%\slb\x64\zlib.lib %_DEST%\lib\x64\zlib.lib -..\%__SRC%\slb\x64\zlib.lin %_DEST%\lib\x64\zlib.lin diff --git a/zlib/prj/dmake b/zlib/prj/dmake deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/zlib/zlib-dmakebuild.patch b/zlib/zlib-dmakebuild.patch deleted file mode 100644 index 7a3abb31ccbd..000000000000 --- a/zlib/zlib-dmakebuild.patch +++ /dev/null @@ -1,68 +0,0 @@ ---- misc/zlib-1.2.7/makefile.mk Fri Mar 14 10:17:06 2008 -+++ misc/build/zlib-1.2.7/makefile.mk Fri Mar 14 10:16:56 2008 -@@ -1 +1,64 @@ --dummy -+#************************************************************************* -+# -+# Copyright according the GNU Public License. -+# -+#************************************************************************* -+ -+PRJ=..$/..$/..$/.. -+ -+PRJNAME=zlib -+TARGET=zlib -+LIBTARGET=NO -+EXTERNAL_WARNINGS_NOT_ERRORS=TRUE -+UWINAPILIB= -+ -+# --- Settings ----------------------------------------------------- -+ -+.INCLUDE : settings.mk -+ -+# --- Files -------------------------------------------------------- -+ -+INCEXT=contrib$/minizip -+ -+SLOFILES= $(SLO)$/adler32.obj \ -+ $(SLO)$/compress.obj \ -+ $(SLO)$/deflate.obj \ -+ $(SLO)$/crc32.obj \ -+ $(SLO)$/inffast.obj \ -+ $(SLO)$/inflate.obj \ -+ $(SLO)$/inftrees.obj \ -+ $(SLO)$/trees.obj \ -+ $(SLO)$/zutil.obj -+ -+ -+LIB1TARGET=$(SLB)$/$(TARGET).lib -+LIB1ARCHIV=$(LB)$/lib$(TARGET).a -+LIB1OBJFILES=$(SLOFILES) -+ -+.IF "$(BUILD_X64)"!="" -+SLOFILES_X64= $(SLO_X64)$/adler32.obj \ -+ $(SLO_X64)$/compress.obj \ -+ $(SLO_X64)$/deflate.obj \ -+ $(SLO_X64)$/crc32.obj \ -+ $(SLO_X64)$/inffast.obj \ -+ $(SLO_X64)$/inflate.obj \ -+ $(SLO_X64)$/inftrees.obj \ -+ $(SLO_X64)$/trees.obj \ -+ $(SLO_X64)$/zutil.obj -+ -+LIB1TARGET_X64=$(SLB_X64)$/$(TARGET).lib -+LIB1OBJFILES_X64=$(SLOFILES_X64) -+.ENDIF # "$(BUILD_X64)"!="" -+ -+ -+# --- Targets ------------------------------------------------------ -+ -+$(MISC)$/%.c : contrib$/minizip$/%.c -+ @echo ------------------------------ -+ @echo Making: $@ -+ @$(COPY) $< $@ -+ -+.INCLUDE : set_wntx64.mk -+.INCLUDE : target.mk -+.INCLUDE : tg_wntx64.mk -+ -- cgit