diff options
author | Norbert Thiebaud <nthiebaud@gmail.com> | 2011-09-17 13:46:08 -0500 |
---|---|---|
committer | Norbert Thiebaud <nthiebaud@gmail.com> | 2011-09-30 13:44:50 -0500 |
commit | 8a2776971de1e460bc38d11223d530eed7878296 (patch) | |
tree | 8330e1e06d595f65b8dc63a1cd4be921727c9d09 | |
parent | bba594a82088ce9631bbee1fd0fed2aedf3c2fa2 (diff) |
preliminary work on a ExternalLib extension support for gbuild
-rw-r--r-- | solenv/gbuild/ExternalLib.mk | 104 | ||||
-rw-r--r-- | solenv/gbuild/LinkTarget.mk | 9 | ||||
-rw-r--r-- | solenv/gbuild/TargetLocations.mk | 4 | ||||
-rw-r--r-- | solenv/gbuild/gbuild.mk | 1 |
4 files changed, 118 insertions, 0 deletions
diff --git a/solenv/gbuild/ExternalLib.mk b/solenv/gbuild/ExternalLib.mk new file mode 100644 index 000000000000..cee876f9c2e5 --- /dev/null +++ b/solenv/gbuild/ExternalLib.mk @@ -0,0 +1,104 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# -*- 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@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_REPOSITORYNAMES := $(gb_Helper_REPOSITORYNAMES) + +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 -f $$(call gb_ExternalLib_get_target,$(1)) \ + rm -rf $(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)) && \ + tar -x -C $(call gb_ExternalLib_get_builddir,$(1)) --strip-component=1 -f $< && \ + pushd $(call gb_ExternalLib_get_builddir,$(1)) && for p in $(T_PATCHES) ; do patch -p 1 < $(gb_REPOS)/$$p || exit 1; done && \ + CC="$(gb_CC)" CXX="$(gb_CXX)" CFLAGS="$(T_CFLAGS)" CXXFLAGS="$(T_CXXFLAGS)" ./configure --prefix=$(OUTDIR) $(T_CONF_ARGS) && \ + for p in $(T_POST_PATCHES) ; do patch -p 1 < $(gb_REPOS)/$p || exit 1; done + +MAKEFLAGS=$(filterout r,$(MAKEFLAGS)) $(MAKE) -C $(call gb_ExternalLib_get_builddir,$(1)) + +$(MAKE) -C $(call gb_ExternalLib_get_builddir,$(1)) install +endef diff --git a/solenv/gbuild/LinkTarget.mk b/solenv/gbuild/LinkTarget.mk index c74bed839c42..3b5356c2d708 100644 --- a/solenv/gbuild/LinkTarget.mk +++ b/solenv/gbuild/LinkTarget.mk @@ -763,6 +763,15 @@ $$(foreach lib,$(2),$$(call gb_StaticLibrary_get_headers_target,$$(lib))) endef +define gb_LinkTarget_add_linked_static_external_libs + +$(call gb_LinkTarget_get_target,$(1)) : LINKED_STATIC_LIBS += $(2) + +$(call gb_LinkTarget_get_target,$(1)) : $$(foreach lib,$(2),$$(call gb_ExternalLibs_get_target,$$(lib))) +$(call gb_LinkTarget_get_external_headers_target,$(1)) : $$(foreach lib,$(2),$$(call gb_ExternalLibs_get_target,$$(lib))) + +endef + define gb_LinkTarget_add_cobject $(call gb_LinkTarget_get_target,$(1)) : COBJECTS += $(2) $(call gb_LinkTarget_get_clean_target,$(1)) : COBJECTS += $(2) diff --git a/solenv/gbuild/TargetLocations.mk b/solenv/gbuild/TargetLocations.mk index 2949a3a84e53..7f067d2bcd7b 100644 --- a/solenv/gbuild/TargetLocations.mk +++ b/solenv/gbuild/TargetLocations.mk @@ -79,6 +79,9 @@ gb_CxxObject_get_target = $(WORKDIR)/CxxObject/$(1).o gb_GenCxxObject_get_target = $(WORKDIR)/GenCxxObject/$(1).o gb_Executable_get_external_headers_target = $(WORKDIR)/ExternalHeaders/Executable/$(1) gb_Executable_get_headers_target = $(WORKDIR)/Headers/Executable/$(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_Jar_get_target = $(WORKDIR)/Jar/$(1).jar gb_Jar_get_classsetname = Jar/$(1) gb_JavaClassSet_get_classdir = $(WORKDIR)/JavaClassSet/$(1) @@ -167,6 +170,7 @@ $(eval $(call gb_Helper_make_clean_targets,\ SrsTemplateTarget \ CppunitTest \ CustomTarget \ + ExternalLib \ UnoApiTarget \ WinResTarget \ YaccObject \ diff --git a/solenv/gbuild/gbuild.mk b/solenv/gbuild/gbuild.mk index 393a25760877..6c387c2cff81 100644 --- a/solenv/gbuild/gbuild.mk +++ b/solenv/gbuild/gbuild.mk @@ -299,6 +299,7 @@ include $(foreach class, \ SdiTarget \ Package \ CustomTarget \ + ExternalLib \ PrecompiledHeaders \ Pyuno \ RdbTarget \ |