Kaydet (Commit) 8a277697 authored tarafından Norbert Thiebaud's avatar Norbert Thiebaud

preliminary work on a ExternalLib extension support for gbuild

üst bba594a8
# -*- 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
......@@ -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)
......
......@@ -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 \
......
......@@ -299,6 +299,7 @@ include $(foreach class, \
SdiTarget \
Package \
CustomTarget \
ExternalLib \
PrecompiledHeaders \
Pyuno \
RdbTarget \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment