[Libreoffice-commits] .: Branch 'feature/gbuild_external' - 3 commits - hsqldb/ExternalProject_hsqldb.mk hsqldb/Makefile hsqldb/makefile.mk hsqldb/Module_hslqdb.mk hsqldb/Package_hsqldb.mk hsqldb/prj hsqldb/UnpackedTarball_hsqldb.mk Makefile.top Module_tail_build.mk RepositoryModule_ooo.mk solenv/gbuild tail_build/prj

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Aug 24 01:41:19 PDT 2012


 Makefile.top                     |    2 
 Module_tail_build.mk             |    3 +
 RepositoryModule_ooo.mk          |    1 
 hsqldb/ExternalProject_hsqldb.mk |   36 ++++++++++++
 hsqldb/Makefile                  |    7 ++
 hsqldb/Module_hslqdb.mk          |   20 +++++++
 hsqldb/Package_hsqldb.mk         |   16 +++++
 hsqldb/UnpackedTarball_hsqldb.mk |   33 +++++++++++
 hsqldb/makefile.mk               |   94 ---------------------------------
 hsqldb/prj/d.lst                 |    1 
 solenv/gbuild/ExternalLib.mk     |  111 ---------------------------------------
 solenv/gbuild/ExternalProject.mk |  104 ++++++++++++++++++++++++++++++++++++
 solenv/gbuild/Package.mk         |    6 ++
 solenv/gbuild/TargetLocations.mk |    9 +--
 solenv/gbuild/UnpackedTarball.mk |   18 ++++++
 solenv/gbuild/gbuild.mk          |    2 
 tail_build/prj/build.lst         |    2 
 17 files changed, 252 insertions(+), 213 deletions(-)

New commits:
commit 07a22b2f47f63d531625173df45dbbcb12b42c81
Author: David Tardon <dtardon at redhat.com>
Date:   Fri Aug 24 10:30:28 2012 +0200

    add hsqldb to tail_build
    
    Change-Id: Ic11e4443c7c29dba22a19436758d14dd35d9523c

diff --git a/Module_tail_build.mk b/Module_tail_build.mk
index ac29fda..903ce93 100644
--- a/Module_tail_build.mk
+++ b/Module_tail_build.mk
@@ -62,6 +62,9 @@ $(eval $(call gb_Module_add_moduledirs,tail_end,\
     formula \
     fpicker \
     framework \
+	$(if $(filter HSQLDB,$(BUILD_TYPE)),\
+		hsqldb \
+	) \
     hwpfilter \
 	i18npool \
 	i18nutil \
diff --git a/tail_build/prj/build.lst b/tail_build/prj/build.lst
index 769a393..7fc74f2 100644
--- a/tail_build/prj/build.lst
+++ b/tail_build/prj/build.lst
@@ -1,2 +1,2 @@
-tb      tail_build : AFMS:afms APACHE_COMMONS:apache-commons BSH:beanshell BERKELEYDB:berkeleydb BOOST:boost CAIRO:cairo CPPUNIT:cppunit DESKTOP:codemaker CURL:curl EXPAT:expat FONTCONFIG:fontconfig FREETYPE:freetype GLIB:glib GRAPHITE:graphite HSQLDB:hsqldb HUNSPELL:hunspell HYPHEN:hyphen ICU:icu DESKTOP:l10ntools JFREEREPORT:jfreereport JPEG:jpeg LCMS2:lcms2 LIBCDR:libcdr LIBCMIS:libcmis LIBEXTTEXTCAT:libexttextcat LIBLANGTAG:liblangtag LIBMSPUB:libmspub LIBXML2:libxml2 libxmlsec LIBXSLT:libxslt LIBWPG:libwpg LIBWPS:libwps LIBWPD:libwpd LIBVISIO:libvisio LPSOLVE:lpsolve MDDS:mdds MOZ:moz MYTHES:mythes NEON:neon NSS:nss OPENLDAP:openldap OPENSSL:openssl POSTGRESQL:postgresql PYTHON:python REDLAND:redland SAXON:saxon TRANSLATIONS:translations VIGRA:vigra XPDF:xpdf ZLIB:zlib bridges cli_ure comphelper cppu cppuhelper external jurt jvmaccess jvmfwk offapi officecfg DESKTOP:rdbmaker readlicense_oo RHINO:rhino ridljar sal salhelper solenv soltools stoc ucbhelper ucpp udkapi xmlr
 eader xsltml NULL
+tb      tail_build : AFMS:afms APACHE_COMMONS:apache-commons BSH:beanshell BERKELEYDB:berkeleydb BOOST:boost CAIRO:cairo CPPUNIT:cppunit DESKTOP:codemaker CURL:curl EXPAT:expat FONTCONFIG:fontconfig FREETYPE:freetype GLIB:glib GRAPHITE:graphite HUNSPELL:hunspell HYPHEN:hyphen ICU:icu DESKTOP:l10ntools JFREEREPORT:jfreereport JPEG:jpeg LCMS2:lcms2 LIBCDR:libcdr LIBCMIS:libcmis LIBEXTTEXTCAT:libexttextcat LIBLANGTAG:liblangtag LIBMSPUB:libmspub LIBXML2:libxml2 libxmlsec LIBXSLT:libxslt LIBWPG:libwpg LIBWPS:libwps LIBWPD:libwpd LIBVISIO:libvisio LPSOLVE:lpsolve MDDS:mdds MOZ:moz MYTHES:mythes NEON:neon NSS:nss OPENLDAP:openldap OPENSSL:openssl POSTGRESQL:postgresql PYTHON:python REDLAND:redland SAXON:saxon TRANSLATIONS:translations VIGRA:vigra XPDF:xpdf ZLIB:zlib bridges cli_ure comphelper cppu cppuhelper external jurt jvmaccess jvmfwk offapi officecfg DESKTOP:rdbmaker readlicense_oo RHINO:rhino ridljar sal salhelper solenv soltools stoc ucbhelper ucpp udkapi xmlreader xsltml N
 ULL
 tb tail_build\prj nmake - all tb_prj   NULL
commit 8f024476847b82bac7bab354482be9cf2f4ca869
Author: David Tardon <dtardon at redhat.com>
Date:   Fri Aug 24 10:21:42 2012 +0200

    gbuildize hsqldb
    
    Change-Id: I35bf8094c9dcf0f70e59c1304ab5a6800393fa29

diff --git a/Makefile.top b/Makefile.top
index 1253984..e1c5089 100644
--- a/Makefile.top
+++ b/Makefile.top
@@ -69,6 +69,7 @@ forms\
 formula\
 fpicker\
 framework\
+hsqldb\
 hwpfilter\
 i18npool\
 i18nutil\
@@ -190,7 +191,6 @@ gettext\
 glib\
 graphite\
 helpcontent2 \
-hsqldb\
 hunspell\
 hyphen\
 icu\
diff --git a/RepositoryModule_ooo.mk b/RepositoryModule_ooo.mk
index d46e387..8142227 100644
--- a/RepositoryModule_ooo.mk
+++ b/RepositoryModule_ooo.mk
@@ -67,6 +67,7 @@ $(eval $(call gb_Module_add_moduledirs,ooo,\
     formula \
     fpicker \
     framework \
+	hsqldb \
     hwpfilter \
     i18npool \
     i18nutil \
diff --git a/hsqldb/ExternalProject_hsqldb.mk b/hsqldb/ExternalProject_hsqldb.mk
new file mode 100644
index 0000000..c41d5dd
--- /dev/null
+++ b/hsqldb/ExternalProject_hsqldb.mk
@@ -0,0 +1,36 @@
+# -*- 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/.
+#
+
+# for RSCREVISION
+include $(SOLARENV)/inc/minor.mk
+
+$(eval $(call gb_ExternalProject_ExternalProject,hsqldb))
+
+$(eval $(call gb_ExternalProject_use_unpacked,hsqldb,hsqldb))
+
+$(eval $(call gb_ExternalProject_register_targets,hsqldb,\
+	build \
+))
+
+$(call gb_ExternalProject_get_state_target,hsqldb,build) :
+	cd $(EXTERNAL_WORKDIR) && \
+	$(ANT) \
+		-q \
+		-f build/build.xml \
+		-Dbuild.label="build-$(RSCREVISION)" \
+		$(if $(filter yes,$(JAVACISGCJ))\
+			,-Dbuild.compiler=gcj \
+			,-Dant.build.javac.source=$(JAVA_SOURCE_VER) \
+				-Dant.build.javac.target=$(JAVA_TARGET_VER) \
+		) \
+		$(if $(debug),-Dbuild.debug="on") \
+		jar && \
+	touch $@
+
+# vim: set noet sw=4 ts=4:
diff --git a/hsqldb/Makefile b/hsqldb/Makefile
new file mode 100644
index 0000000..ccb1c85
--- /dev/null
+++ b/hsqldb/Makefile
@@ -0,0 +1,7 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+
+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/hsqldb/Module_hslqdb.mk b/hsqldb/Module_hslqdb.mk
new file mode 100644
index 0000000..ef31358
--- /dev/null
+++ b/hsqldb/Module_hslqdb.mk
@@ -0,0 +1,20 @@
+# -*- 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_Module_Module,hsqldb))
+
+ifneq ($(SOLAR_JAVA),)
+$(eval $(call gb_Module_add_targets,hsqldb,\
+	ExternalProject_hsqldb \
+	Package_hsqldb \
+	UnpackedTarball_hsqldb \
+))
+endif
+
+# vim: set noet sw=4 ts=4:
diff --git a/hsqldb/Package_hsqldb.mk b/hsqldb/Package_hsqldb.mk
new file mode 100644
index 0000000..c0583bc
--- /dev/null
+++ b/hsqldb/Package_hsqldb.mk
@@ -0,0 +1,16 @@
+# -*- 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_Package_Package,hsqldb_project,$(call gb_UnpackedTarball_get_dir,hsqldb)))
+
+$(eval $(call gb_Package_use_external_project,hsqldb_output,hsqldb))
+
+$(eval $(call gb_Package_add_file,hsqldb,bin/hsqldb.jar,lib/hsqldb.jar))
+
+# vim: set noet sw=4 ts=4:
diff --git a/hsqldb/UnpackedTarball_hsqldb.mk b/hsqldb/UnpackedTarball_hsqldb.mk
new file mode 100644
index 0000000..9c9b87a
--- /dev/null
+++ b/hsqldb/UnpackedTarball_hsqldb.mk
@@ -0,0 +1,33 @@
+# -*- 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,hsqldb))
+
+include $(SRCDIR)/hsqldb/version.mk
+
+$(eval $(call gb_UnpackedTarball_set_tarball,hsqldb,17410483b5b5f267aa18b7e00b65e6e0-hsqldb_$(HSQLDB_VERSION).zip))
+
+$(eval $(call gb_UnpackedTarball_fix_end_of_line,hsqldb,\
+	build/build.xml \
+	src/org/hsqldb/Library.java \
+	src/org/hsqldb/persist/HsqlDatabaseProperties.java \
+))
+
+$(eval $(call gb_UnpackedTarball_add_patches,hsqldb,\
+	hsqldb/patches/i96823.patch \
+	hsqldb/patches/i97032.patch \
+	hsqldb/patches/i103528.patch \
+	hsqldb/patches/i104901.patch \
+	hsqldb/patches/fdo36824.patch \
+	$(if $(filter-out 1.5,$(JAVA_SOURCE_VER)),\
+		hsqldb/patches/jdbc-4.1.patch \
+	) \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/hsqldb/makefile.mk b/hsqldb/makefile.mk
deleted file mode 100644
index fe1c9d9..0000000
--- a/hsqldb/makefile.mk
+++ /dev/null
@@ -1,94 +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
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-PRJ=.
-
-PRJNAME=hsqldb
-TARGET=so_hsqldb
-
-# --- Settings -----------------------------------------------------
-
-.INCLUDE :	settings.mk
-
-# override buildfile
-ANT_BUILDFILE=build$/build.xml
-
-.INCLUDE : antsettings.mk
-
-.INCLUDE :  tg_javav.mk
-
-.INCLUDE :  version.mk
-
-.IF "$(SOLAR_JAVA)" != ""
-# --- Files --------------------------------------------------------
-
-TARFILE_NAME=hsqldb_$(HSQLDB_VERSION)
-TARFILE_MD5=17410483b5b5f267aa18b7e00b65e6e0
-
-TARFILE_ROOTDIR=hsqldb
-
-CONVERTFILES=build$/build.xml \
-            src$/org$/hsqldb$/persist$/HsqlDatabaseProperties.java \
-            src$/org$/hsqldb$/Library.java
-
-PATCH_FILES=patches$/i96823.patch \
-            patches$/i97032.patch \
-            patches$/i103528.patch \
-            patches$/i104901.patch \
-            patches$/fdo36824.patch
-
-.IF "$(JAVANUMVER:s/.//)" >= "000100060000"
-PATCH_FILES+= \
-            patches$/jdbc-4.1.patch
-.ENDIF
-
-.IF "$(JAVACISGCJ)"=="yes" || "$(JAVA_SOURCE_VER)"=="1.5"
-JAVA_HOME=
-.EXPORT : JAVA_HOME
-.ENDIF
-
-.IF "$(JAVACISGCJ)"=="yes"
-BUILD_ACTION="$(ANT)" -Dbuild.label="build-$(RSCREVISION)" -Dbuild.compiler=gcj -f $(ANT_BUILDFILE) jar
-.ELSE
-BUILD_ACTION="$(ANT)" -Dbuild.label="build-$(RSCREVISION)" -Dant.build.javac.source=$(JAVA_SOURCE_VER) -Dant.build.javac.target=$(JAVA_TARGET_VER) -f $(ANT_BUILDFILE) jar
-.ENDIF
-
-.IF "$(debug)"!=""
-BUILD_ACTION+=-Dbuild.debug="on"
-.ENDIF
-
-.ENDIF # $(SOLAR_JAVA)!= ""
-
-# --- Targets ------------------------------------------------------
-
-.INCLUDE : set_ext.mk
-.INCLUDE : target.mk
-
-.IF "$(SOLAR_JAVA)" != ""
-.INCLUDE : tg_ext.mk
-.ENDIF
-
diff --git a/hsqldb/prj/d.lst b/hsqldb/prj/d.lst
index d432e98..e69de29 100644
--- a/hsqldb/prj/d.lst
+++ b/hsqldb/prj/d.lst
@@ -1 +0,0 @@
-..\%__SRC%\misc\build\hsqldb\lib\hsqldb.jar %_DEST%\bin\hsqldb.jar
diff --git a/hsqldb/prj/dmake b/hsqldb/prj/dmake
deleted file mode 100644
index e69de29..0000000
commit 6c1a3d2433314c449c4014631deedc670688270d
Author: David Tardon <dtardon at redhat.com>
Date:   Fri Aug 24 09:41:50 2012 +0200

    add support for building external projects
    
    Change-Id: I1ae354e3bf85c29679919f6382e14d3e4232d798

diff --git a/solenv/gbuild/ExternalLib.mk b/solenv/gbuild/ExternalLib.mk
deleted file mode 100644
index 5ac3c14..0000000
--- a/solenv/gbuild/ExternalLib.mk
+++ /dev/null
@@ -1,111 +0,0 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-#
-# Version: MPL 1.1 / GPLv3+ / LGPLv3+
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-# http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# Major Contributor(s):
-# Copyright (C) 2011 Norbert Thiebaud <nthiebaud at gmail.com>
-#
-# All Rights Reserved.
-#
-# For minor contributions see the git repository.
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 3 or later (the "GPLv3+"), or
-# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
-# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
-# instead of those above.
-
-gb_ExternalLib_get_src_package = $(TARFILE_LOCATION)/$(1)
-
-define gb_ExternalLib_ExternalLib
-$(call gb_ExternalLib_get_target,$(1)): T_PATCHES:=
-$(call gb_ExternalLib_get_target,$(1)): T_POST_PATCHES:=
-$(call gb_ExternalLib_get_target,$(1)): T_CONF_ARGS:=
-$(call gb_ExternalLib_get_target,$(1)): T_BUILD_MODE:=$(2)
-$$(eval $$(call gb_Module_register_target,$(call gb_ExternalLib_get_target,$(1)),$(call gb_ExternalLib_get_clean_target,$(1))))
-
-ifeq ($(strip $(2)),autotools)
-$(call gb_ExternalLib_get_target,$(1)) :
-	$$(call gb_Output_announce,$*,$(true),MAK,3)
-	$$(call gb_ExternalLib__command_autotools,$(1));
-	touch $(call gb_ExternalLib_get_target,$(1));
-
-.PHONY: $(call gb_ExternalLib_get_clean_target,$(1))
-$(call gb_ExternalLib_get_clean_target,$(1)) :
-	$$(call gb_Output_announce,$(1),$(false),MAK,3)
-	$$(call gb_Helper_abbreviate_dirs,\
-	    if test -f $(call gb_ExternalLib_get_builddir,$(1))/Makefile ; then cd $$(call gb_ExternalLib_get_builddir,$(1)) && make uninstall ; fi ; \
-	    rm -rf $(call gb_ExternalLib_get_target,$(1)) \
-		$(call gb_ExternalLib_get_workdir,$(1)))
-
-else
-	$$(call gb_Output_error,$(2) is not a supported ExternalLib mode)
-endif
-
-endef
-
-define gb_ExternalLib_set_src_package
-$(call gb_ExternalLib_get_target,$(1)): $(call gb_ExternalLib_get_src_package,$(2))
-
-endef
-
-define gb_ExternalLib_add_patch
-$(call gb_ExternalLib_get_target,$(1)): T_PATCHES+=$(2)
-
-endef
-
-define gb_ExternalLib_add_patches
-$(foreach patch,$(2),$(call gb_ExternalLib_add_patch,$(1),$(patch)))
-
-endef
-
-define gb_ExternalLib_add_post_patch
-$(call gb_ExternalLib_get_target,$(1)): T_POST_PATCHES+=$(2)
-
-endef
-
-define gb_ExternalLib_add_post_patches
-$(foreach patch,$(2),$(call gb_ExternalLib_add_patch,$(1),$(patch)))
-
-endef
-
-define gb_ExternalLib_add_conf_arg
-$(call gb_ExternalLib_get_target,$(1)): T_CONF_ARGS+=$(2)
-
-endef
-
-define gb_ExternalLib_add_cxxflags
-$(call gb_ExternalLib_get_target,$(1)) : T_CXXFLAGS += $(2)
-
-endef
-
-define gb_ExternalLib_add_cflags
-$(call gb_ExternalLib_get_target,$(1)) : T_CFLAGS += $(2)
-
-endef
-
-
-define gb_ExternalLib__command_autotools
-	rm -fr $(call gb_ExternalLib_get_workdir,$(1)) && \
-	mkdir -p $(call gb_ExternalLib_get_builddir,$(1)) && \
-	$(GNUTAR) -x -C $(call gb_ExternalLib_get_builddir,$(1)) --strip-components=1 -f $< && \
-	cd $(call gb_ExternalLib_get_builddir,$(1)) && for p in $(T_PATCHES) ; do patch -p 1 < $(SRCDIR)/$$p || exit 1; done && \
-	CC="$(gb_CC)" CXX="$(gb_CXX)" CFLAGS="$(T_CFLAGS)" CXXFLAGS="$(T_CXXFLAGS)" PKG_CONFIG_PATH="$(PKG_CONFIG_PATH) $(OUTDIR)/lib/pkgconfig" ./configure $(if $(findstring YES,$(CROSS_COMPILING)),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)) --prefix=$(OUTDIR) $(T_CONF_ARGS) && \
-	for p in $(T_POST_PATCHES) ; do patch -p 1 < $(SRCDIR)/$p || exit 1; done
-	#we don't want a deployed rpath pointing into our solver, to-do, set correct ORIGIN-foo ?
-	cd $(call gb_ExternalLib_get_builddir,$(1)) && if test -e libtool ; then sed -i -e 's,^hardcode_libdir_flag_spec=.*,hardcode_libdir_flag_spec="",g' libtool && sed -i -e 's,^runpath_var=LD_RUN_PATH,runpath_var=DIE_RPATH_DIE,g' libtool; fi
-	+MAKEFLAGS=$(filterout r,$(MAKEFLAGS)) $(MAKE) -C $(call gb_ExternalLib_get_builddir,$(1))
-	+$(MAKE) -C $(call gb_ExternalLib_get_builddir,$(1)) install
-endef
-
-# vim: set noet sw=4 ts=4:
diff --git a/solenv/gbuild/ExternalProject.mk b/solenv/gbuild/ExternalProject.mk
new file mode 100644
index 0000000..15ca6bc
--- /dev/null
+++ b/solenv/gbuild/ExternalProject.mk
@@ -0,0 +1,104 @@
+# -*- 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/.
+#
+
+# class ExternalProject
+
+# Handles build of an external project
+
+# Build of an external typically uses three gbuild classes:
+# ExternalProject, Package and UnpackedTarball. The first step is to
+# prepare sources using UnpackedTarball. The tarball is passed to an
+# ExternalProject, which handles the build proper and the results are
+# delivered by a Package.
+#
+# ExternalProject has no gbuild abstraction for actually building the
+# external code, so it is necessary to define rule(s) and recipe(s) to
+# handle it. It does not matter if there are several rules handling
+# separate phases of the build (e.g., configure, build, install) or if
+# the whole build is handled by one rule.
+#
+# ExternalProject uses two directories during the build: state dir
+# serves to keep file targets that mark state of the build progress
+# (e.g., "configure done", "build done") and the targets are accessible
+# via gb_ExternalProject_get_state_target. It is highly advised to
+# register them using gb_ExternalProject_register_targets. The second
+# directory is work dir, accessible only from recipes via variable
+# $(EXTERNAL_WORKDIR).
+
+$(dir $(call gb_ExternalProject_get_statedir,%))%/.dir :
+	$(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
+
+$(dir $(call gb_ExternalProject_get_target,%)).dir :
+	$(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
+
+$(call gb_ExternalProject_get_preparation_target,%) :
+	touch $@
+
+$(call gb_ExternalProject_get_target,%) :
+	$(call gb_Output_announce,$*,$(true),PRJ,3)
+	touch $@
+
+.PHONY : $(call gb_ExternalProject_get_clean_target,%)
+$(call gb_ExternalProject_get_clean_target,%) :
+	$(call gb_Output_announce,$*,$(false),PRJ,3)
+	$(call gb_Helper_abbreviate_dirs,\
+		rm -rf \
+			$(call gb_ExternalProject_get_target,$*) \
+			$(call gb_ExternalProject_get_statedir,$*) \
+	)
+
+# Define a new external project
+#
+# gb_ExternalProject_ExternalProject project
+define gb_ExternalProject_ExternalProject
+$(call gb_ExternalProject_get_target,$(1)) : EXTERNAL_WORKDIR :=
+
+$(call gb_ExternalProject_get_preparation_target,$(1)) :| $(dir $(call gb_ExternalProject_get_target,$(1))).dir
+$(call gb_ExternalProject_get_target,$(1)) : $(call gb_ExternalProject_get_preparation_target,$(1))
+$(call gb_ExternalProject_get_target,$(1)) :| $(dir $(call gb_ExternalProject_get_target,$(1))).dir
+
+$$(eval $$(call gb_Module_register_target,$(call gb_ExternalProject_get_target,$(1)),$(call gb_ExternalProject_get_clean_target,$(1))))
+
+endef
+
+# Use unpacked tarball as source for build
+#
+# gb_ExternalProject_use_unpacked project unpacked
+define gb_ExternalProject_use_unpacked
+$(call gb_ExternalProject_get_target,$(1)) : EXTERNAL_WORKDIR := $(call gb_UnpackedTarball_get_dir,$(2))
+
+$(call gb_ExternalProject_get_preparation_target,$(1)) : $(call gb_UnpackedTarball_get_target,$(2))
+$(call gb_ExternalProject_get_clean_target,$(1)) : $(call gb_UnpackedTarball_get_clean_target,$(2))
+
+endef
+
+# Register a target in state directory
+#
+# This function defines proper dependencies for the target to ensure
+# that:
+# * the main target is updated if this target is updated
+# * this target is updated if the unpacked tarball has changed.
+#
+# gb_ExternalProject_register_target project target
+define gb_ExternalProject_register_target
+$(call gb_ExternalProject_get_target,$(1)) : $(call gb_ExternalProject_get_state_target,$(1),$(2))
+$(call gb_ExternalProject_get_state_target,$(1),$(2)) : $(call gb_ExternalProject_get_preparation_target,$(1))
+$(call gb_ExternalProject_get_state_target,$(1),$(2)) :| $(dir $(call gb_ExternalProject_get_state_target,$(1),$(2))).dir
+
+endef
+
+# Register several targets at once
+#
+# gb_ExternalProject_register_targets project target(s)
+define gb_ExternalProject_register_targets
+$(foreach target,$(2),$(call gb_ExternalProject_register_target,$(1),$(target)))
+
+endef
+
+# vim: set noet sw=4 ts=4:
diff --git a/solenv/gbuild/Package.mk b/solenv/gbuild/Package.mk
index 23aecee..534e39a 100644
--- a/solenv/gbuild/Package.mk
+++ b/solenv/gbuild/Package.mk
@@ -120,4 +120,10 @@ $(call gb_Package_get_preparation_target,$(1)) :| $(call gb_UnpackedTarball_get_
 
 endef
 
+# Package files from build of an external project
+define gb_Package_use_external_project
+$(call gb_Package_get_preparation_target,$(1)) :| $(call gb_ExternalProject_get_target,$(2))
+
+endef
+
 # vim: set noet sw=4:
diff --git a/solenv/gbuild/TargetLocations.mk b/solenv/gbuild/TargetLocations.mk
index 333dbeb..e06e481 100644
--- a/solenv/gbuild/TargetLocations.mk
+++ b/solenv/gbuild/TargetLocations.mk
@@ -92,9 +92,10 @@ gb_Executable_get_headers_target = $(WORKDIR)/Headers/Executable/$(1)
 gb_ExtensionTarget_get_target = $(WORKDIR)/ExtensionTarget/$(1).oxt
 gb_ExtensionTarget_get_rootdir = $(WORKDIR)/ExtensionTarget/$(1)/root
 gb_ExtensionTarget_get_workdir = $(WORKDIR)/ExtensionTarget/$(1)
-gb_ExternalLib_get_workdir = $(WORKDIR)/ExternalLib/$(1)
-gb_ExternalLib_get_builddir = $(WORKDIR)/ExternalLib/$(1)/build
-gb_ExternalLib_get_target = $(WORKDIR)/ExternalLib/$(1).done
+gb_ExternalProject_get_statedir = $(WORKDIR)/ExternalProject/$(1)
+gb_ExternalProject_get_preparation_target = $(WORKDIR)/ExternalProject/$(1).prepare
+gb_ExternalProject_get_state_target = $(WORKDIR)/ExternalProject/$(1)/$(2)
+gb_ExternalProject_get_target = $(WORKDIR)/ExternalProject/$(1).done
 gb_InstallModule_get_filelist = $(call gb_InstallModuleTarget_get_filelist,$(1))
 gb_InstallModule_get_target = $(WORKDIR)/InstallModule/$(1).done
 gb_InstallModuleTarget_get_external_target = $(WORKDIR)/InstallModuleTarget/$(1).external
@@ -224,7 +225,7 @@ $(eval $(call gb_Helper_make_clean_targets,\
 	ThesaurusIndexTarget \
 	CppunitTest \
 	CustomTarget \
-	ExternalLib \
+	ExternalProject \
 	UnoApiHeadersTarget \
 	UnoApiTarget \
 	UnpackedTarball \
diff --git a/solenv/gbuild/UnpackedTarball.mk b/solenv/gbuild/UnpackedTarball.mk
index 8d85e01..52b496b 100644
--- a/solenv/gbuild/UnpackedTarball.mk
+++ b/solenv/gbuild/UnpackedTarball.mk
@@ -103,6 +103,9 @@ endef
 # converted, it is better to be changed to 1.
 gb_UnpackedTarball_PATCHLEVEL_DEFAULT := 3
 
+gb_UnpackedTarball_CONVERTTARGET := $(SRCDIR)/solenv/bin/leconvert.pl
+gb_UnpackedTarball_CONVERTCOMMAND := $(PERL) -w $(gb_UnpackedTarball_CONVERTTARGET)
+
 define gb_UnpackedTarball__copy_files_impl
 $(if $(1),\
 	&& cp $(firstword $(1)) $(firstword $(2)) \
@@ -123,11 +126,13 @@ define gb_UnpackedTarball__command
 $(call gb_Output_announce,$(2),$(true),PAT,2)
 $(call gb_Helper_abbreviate_dirs,\
 	cd $(3) && \
+	$(if $(UNPACKED_FIX_EOL),$(gb_UnpackedTarball_CONVERTCOMMAND) unix $(UNPACKED_FIX_EOL) &&) \
 	$(if $(UNPACKED_PATCHES),\
 		for p in $(UNPACKED_PATCHES); do \
 			$(GNUPATCH) -s -p$(UNPACKED_PATCHLEVEL) < "$$p" || exit 1;\
 		done && \
 	) \
+	$(if $(UNPACKED_FIX_EOL),$(gb_UnpackedTarball_CONVERTCOMMAND) dos $(UNPACKED_FIX_EOL) &&) \
 	$(if $(UNPACKED_CXX_SUFFIX),\
 		for c in `find $(3) -type f -name "*.$(UNPACKED_CXX_SUFFIX)"`; do \
 			mv "$$c" "$${c%.$(UNPACKED_CXX_SUFFIX)}.cxx" || exit 1;\
@@ -168,6 +173,7 @@ define gb_UnpackedTarball_UnpackedTarball_internal
 $(call gb_UnpackedTarball_get_target,$(1)) : UNPACKED_CXX_SUFFIX :=
 $(call gb_UnpackedTarball_get_target,$(1)) : UNPACKED_DESTFILES :=
 $(call gb_UnpackedTarball_get_target,$(1)) : UNPACKED_FILES :=
+$(call gb_UnpackedTarball_get_target,$(1)) : UNPACKED_FIX_EOL :=
 $(call gb_UnpackedTarball_get_target,$(1)) : UNPACKED_PATCHES :=
 $(call gb_UnpackedTarball_get_target,$(1)) : UNPACKED_PATCHLEVEL := $(gb_UnpackedTarball_PATCHLEVEL_DEFAULT)
 $(call gb_UnpackedTarball_get_target,$(1)) : UNPACKED_POST_ACTION :=
@@ -187,6 +193,18 @@ $$(eval $$(call gb_Module_register_target,$(call gb_UnpackedTarball_get_target,$
 
 endef
 
+# Convert line ending from dos to unix style for selected files
+#
+# This is done before applying patches, because patches expect unix
+# style line ending, and the files are converted back after that. The
+# files are relative to the unpacked path.
+#
+# gb_UnpackedTarball_fix_end_of_line unpacked file(s)
+define gb_UnpackedTarball_fix_end_of_line
+$(call gb_UnpackedTarball_get_target,$(1)) : UNPACKED_FIX_EOL += $(addprefix $(call gb_UnpackedTarball_get_dir,$(1))/,$(2))
+
+endef
+
 # Set suffix of C++ files, if different from 'cxx'
 #
 # All files with that extension will be renamed to .cxx . This is because
diff --git a/solenv/gbuild/gbuild.mk b/solenv/gbuild/gbuild.mk
index d479a00..b4b3cdb 100644
--- a/solenv/gbuild/gbuild.mk
+++ b/solenv/gbuild/gbuild.mk
@@ -305,7 +305,7 @@ include $(foreach class, \
 	SdiTarget \
 	Package \
 	CustomTarget \
-	ExternalLib \
+	ExternalProject \
 	Pagein \
 	Pyuno \
 	Rdb \


More information about the Libreoffice-commits mailing list