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

Prepare for read-only source build

This patch allows to do

mkdir <build_dir>
cd <build_dir>
<src_root>/autogen.sh
make

Only the remaining dmake modules are poluting the <src_root>...
which will get eventually convererd to gmake...

Change-Id: Iefd64732fa12e096d554cff4eee6b777deb92338
Reviewed-on: https://gerrit.libreoffice.org/1273Reviewed-by: 's avatarLuboš Luňák <l.lunak@suse.cz>
Reviewed-by: 's avatarNorbert Thiebaud <nthiebaud@gmail.com>
Tested-by: 's avatarNorbert Thiebaud <nthiebaud@gmail.com>
üst 8532cbd3
......@@ -61,6 +61,7 @@
/configure
/desktop/scripts/soffice.sh
/makefile.mk
/Makefile
/src.downloaded
/intltool-extract.in
/intltool-merge.in
......@@ -98,8 +99,6 @@ TAGS
/solenv/gdb/libreoffice/*.py[co]
/solenv/gdb/libreoffice/util/*.py[co]
# test output files
test/user-template/user/psprint/pspfontcache
# MSVC debug information
/*/vc90.pdb
......
......@@ -70,7 +70,7 @@ endef
download: $(WORKDIR)/download
$(WORKDIR)/download: $(SRCDIR)/config_host.mk $(SRCDIR)/download.lst $(SRCDIR)/Makefile.fetch
$(WORKDIR)/download: $(BUILD_DIR)/config_host.mk $(SRCDIR)/download.lst $(SRCDIR)/Makefile.fetch
@mkdir -p $(TARFILE_LOCATION)/tmp
@date >> $(fetch_LOGFILE)
$(foreach item, \
......
......@@ -13,23 +13,25 @@ MAKECMDGOALS:=all
endif
SHELL=/usr/bin/env bash
SRCDIR:=$(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST)))))
export SRCDIR:=@SRC_ROOT@
export BUILD_DIR:=$(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST)))))
.PHONY : $(filter-out $(SRCDIR)/config_host.mk,$(MAKECMDGOALS))
.PHONY : $(filter-out $(BUILD_DIR)/config_host.mk,$(MAKECMDGOALS))
# recursively invoke Makefile.top, which includes config_host.mk
$(filter-out help,$(firstword $(MAKECMDGOALS))) : $(SRCDIR)/config_host.mk
$(filter-out help,$(firstword $(MAKECMDGOALS))) : $(BUILD_DIR)/config_host.mk
$(MAKE) -r -f $(SRCDIR)/Makefile.top $(MAKECMDGOALS)
# run configure in an environment not polluted by config_host.mk
$(SRCDIR)/config_host.mk : \
$(BUILD_DIR)/config_host.mk : \
$(SRCDIR)/config_host.mk.in \
$(SRCDIR)/Makefile.in \
$(SRCDIR)/configure.ac \
$(SRCDIR)/autogen.lastrun
./autogen.sh
$(BUILD_DIR)/autogen.lastrun
$(SRCDIR)/autogen.sh
# dummy rule in case autogen.lastrun does not exist
$(SRCDIR)/autogen.lastrun:
$(BUILD_DIR)/autogen.lastrun:
@true
help:
......@@ -37,3 +39,4 @@ help:
@true
# vim: set noet sw=4 ts=4:
......@@ -9,13 +9,13 @@ endif
all: build
SHELL=/usr/bin/env bash
SRCDIR:=$(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST)))))
ifeq ($(gb_Side),)
gb_Side:=host
endif
include $(SRCDIR)/config_$(gb_Side).mk
include $(BUILD_DIR)/config_$(gb_Side).mk
SRCDIR:=$(SRC_ROOT)
ifeq ($(GMAKE_OPTIONS),)
ifeq ($(verbose)$(VERBOSE),)
......@@ -27,7 +27,7 @@ endif
# This list tells which modules are gbuild ones. It does *not* tell which modules to build. That is directed
# by the module being mentioned in packimages/prj/build.lst, etc, recursively.
$(WORKDIR)/modules.mk: $(wildcard */Module_*.mk) $(wildcard */prj/dmake) $(SRCDIR)/config_host.mk
$(WORKDIR)/modules.mk: $(wildcard */Module_*.mk) $(wildcard */prj/dmake) $(BUILD_DIR)/config_host.mk
mkdir -p $(dir $@)
echo -n "gbuild_modules:= tail_build \\" > $@
for m in */Module_*.mk; do echo $$m | sed -e 's/\/.*$$/ \\/'; done >> $@
......@@ -50,10 +50,10 @@ $(1): bootstrap fetch
$(1).all: bootstrap fetch
$$(if $$(filter $(1),$$(shell $(GNUMAKE) -r -f $(SRCDIR)/tail_build/Makefile showmodules)), \
cd tail_build && unset MAKEFLAGS && \
cd $(SRC_ROOT)/tail_build && unset MAKEFLAGS && \
export gb_TAILBUILDTARGET="$(WORKDIR)/Module/$(1) $(WORKDIR)/Module/check/$(1) $(WORKDIR)/Module/slowcheck/$(1)" && \
, \
cd $(1) && unset MAKEFLAGS && \
cd $(SRC_ROOT)/$(1) && unset MAKEFLAGS && \
) \
$(SOLARENV)/bin/build.pl -P$(PARALLELISM) --all -- -P$(PARALLELISM)
......@@ -76,18 +76,18 @@ define dmake_module_rules
.PHONY: $(1) $(1).all $(1).deliver $(1).clean
$(1): bootstrap fetch
cd $(1) && unset MAKEFLAGS && \
cd $(SRC_ROOT)/$(1) && unset MAKEFLAGS && \
$(SOLARENV)/bin/build.pl -P$(PARALLELISM) -- -P$(PARALLELISM)
$(1).all: bootstrap fetch
cd $(1) && unset MAKEFLAGS && \
cd $(SRC_ROOT)/$(1) && unset MAKEFLAGS && \
$(SOLARENV)/bin/build.pl -P$(PARALLELISM) --all -- -P$(PARALLELISM)
$(1).deliver: $(1)
cd $(1) && $(SOLARENV)/bin/deliver.pl
cd $(SRC_ROOT)/$(1) && $(SOLARENV)/bin/deliver.pl
$(1).clean:
cd $(1) && $(SOLARENV)/bin/deliver.pl -delete
cd $(SRC_ROOT)/$(1) && $(SOLARENV)/bin/deliver.pl -delete
rm -fr $(1)/$(INPATH)
endef
......@@ -143,9 +143,9 @@ ifeq ($(BUILD_DMAKE),YES)
(if [ -f dmake/Makefile ] ; then $(GNUMAKE) -j $(PARALLELISM) -C dmake distclean; fi) && \
rm -f solenv/*/bin/dmake*
endif
rm -fr config_host.mk config_build.mk aclocal.m4 autom4te.cache \
config.log config.status configure \
config_host.mk.last config_host.mk.stamp warn config/*.h
rm -fr $(BUILD_DIR)/config_host.mk $(BUILD_DIR)/config_build.mk $(BUILD_DIR)/aclocal.m4 $(BUILD_DIR)/autom4te.cache \
$(BUILD_DIR)/config.log $(BUILD_DIR)/config.status $(BUILD_DIR)/configure \
$(BUILD_DIR)/config_host.mk.last $(BUILD_DIR)/config_host.mk.stamp $(BUILD_DIR)/warn $(BUILD_DIR)/config/*.h
find $(SOLARENV)/gdb -name "*.pyc" -exec rm {} \;
#
......@@ -166,11 +166,11 @@ include $(SRCDIR)/Makefile.fetch
fetch: download
fetch: get-submodules
ifneq (,$(wildcard .git))
ifneq (,$(wildcard $(SRCDIR)/.git))
get-submodules:
ifneq ($(foreach i,$(GIT_NEEDED_SUBMODULES),$(i)/.git),$(wildcard $(foreach i,$(GIT_NEEDED_SUBMODULES),$(i)/.git)))
ifeq (,$(GIT_LINK_SRC))
./g -f clone
cd $(SRCDIR) && ./g -f clone
else # space-saving clone from another local workdir
@echo "FIXME: GIT_LINK_SRC method is not yet implemented with submodules" 1>&2
true $(foreach i,$(GIT_NEEDED_SUBMODULES),\
......@@ -225,15 +225,15 @@ ifeq ($(DISABLE_DBCONNECTIVITY),TRUE)
# Ditto for dbconnectivity in the --disable-database-connectivity case
cd connectivity && sed -e 's/^\(export [A-Z0-9_]*=\)\(.*\)$$/\1"\2"/' <../config_host.mk >conftmp.sh && . conftmp.sh && rm conftmp.sh && $(SOLARENV)/bin/deliver.pl
endif
cd packimages && unset MAKEFLAGS && \
cd $(SRC_ROOT)/packimages && unset MAKEFLAGS && \
$(SOLARENV)/bin/build.pl -P$(PARALLELISM) --all -- -P$(PARALLELISM) && \
$(GNUMAKE) -j $(PARALLELISM) $(GMAKE_OPTIONS)
build: build-packimages
ifeq ($(OS_FOR_BUILD),WNT)
cd instsetoo_native && unset MAKEFLAGS && $(SOLARENV)/bin/build.pl
cd $(SRC_ROOT)/instsetoo_native && unset MAKEFLAGS && $(SOLARENV)/bin/build.pl
else
cd instsetoo_native && unset MAKEFLAGS && \
cd $(SRC_ROOT)/instsetoo_native && unset MAKEFLAGS && \
$(SOLARENV)/bin/build.pl -P$(PARALLELISM) -- -P$(PARALLELISM)
endif
ifeq ($(OS),ANDROID)
......@@ -274,7 +274,7 @@ dev-install: build
@rm -rf $(DEVINSTALLDIR)
@mkdir $(DEVINSTALLDIR)
ifeq ($(OS_FOR_BUILD),WNT)
cd instsetoo_native && unset MAKEFLAGS && $(SOLARENV)/bin/build.pl LIBO_DEV_INSTALL=TRUE
cd $(SRC_ROOT)/instsetoo_native && unset MAKEFLAGS && $(SOLARENV)/bin/build.pl LIBO_DEV_INSTALL=TRUE
unzip -q -d "$(DEVINSTALLDIR)" "$(SRCDIR)/instsetoo_native/$(INPATH)/LibreOffice/archive/install/en-US/LibO*_install-arc_en-US.zip"
mv "$(DEVINSTALLDIR)"/LibO*_install-arc_en-US/* "$(DEVINSTALLDIR)"/opt
else
......@@ -301,7 +301,7 @@ install-tb:
@rm -rf $(DEVINSTALLDIR)
@mkdir $(DEVINSTALLDIR)
ifeq ($(OS_FOR_BUILD),WNT)
cd instsetoo_native && unset MAKEFLAGS && $(SOLARENV)/bin/build.pl LIBO_DEV_INSTALL=TRUE
cd $(SRC_ROOT)/instsetoo_native && unset MAKEFLAGS && $(SOLARENV)/bin/build.pl LIBO_DEV_INSTALL=TRUE
unzip -q -d "$(DEVINSTALLDIR)" "$(SRCDIR)/instsetoo_native/$(INPATH)/LibreOffice/archive/install/en-US/LibO*_install-arc_en-US.zip"
mv "$(DEVINSTALLDIR)"/LibO*_install-arc_en-US/* "$(DEVINSTALLDIR)"/opt
else
......@@ -328,7 +328,7 @@ docs:
findunusedcode:
@which callcatcher > /dev/null 2>&1 || \
(echo "callcatcher not installed" && false)
@sed -e s,$$INPATH,callcatcher,g $(SRCDIR)/config_host.mk | sed -e s,"export OOO_JUNIT_JAR=.*","export OOO_JUNIT_JAR=",g > $(SRCDIR)/config_host_callcatcher.mk
@sed -e s,$$INPATH,callcatcher,g config_host.mk | sed -e s,"export OOO_JUNIT_JAR=.*","export OOO_JUNIT_JAR=",g > $(SRCDIR)/config_host_callcatcher.mk
@echo unexport ARCH_FLAGS >> $(SRCDIR)/config_host_callcatcher.mk
@echo unexport CFLAGS >> $(SRCDIR)/config_host_callcatcher.mk
@echo unexport CXXFLAGS >> $(SRCDIR)/config_host_callcatcher.mk
......@@ -370,10 +370,10 @@ findunusedcode:
check: dev-install subsequentcheck
subsequentcheck :| $(if $(filter-out subsequentcheck,$(MAKECMDGOALS)),dev-install)
$(GNUMAKE) -j $(CHECK_PARALLELISM) $(GMAKE_OPTIONS) -f Makefile.post $@
$(GNUMAKE) -j $(CHECK_PARALLELISM) $(GMAKE_OPTIONS) -f $(SRC_ROOT)/Makefile.post $@
unitcheck slowcheck debugrun:
$(GNUMAKE) -j $(PARALLELISM) $(GMAKE_OPTIONS) -f Makefile.post $@
$(GNUMAKE) -j $(PARALLELISM) $(GMAKE_OPTIONS) -f $(SRC_ROOT)/Makefile.post $@
endif # not clean or distclean
......
......@@ -4,6 +4,18 @@
use strict;
use Cwd ('cwd', 'realpath');
use File::Basename;
my $src_path=dirname(realpath($0));
my $build_path=realpath(cwd());
# since this looks crazy, if you have a symlink on a path up to and including
# the current directory, we need our configure to run in the realpath of that
# such that compiled (realpath'd) dependency filenames match the filenames
# used in our makefiles - ie. this gets dependencies right via SRC_ROOT
chdir ($build_path);
# more amazingly, if you don't clobber 'PWD' shells will re-assert their
# old path from the environment, not cwd.
$ENV{PWD} = $build_path;
sub clean()
{
......@@ -79,7 +91,7 @@ sub invalid_distro($$)
print STDERR "Can't find distro option set: $config\nThis is not necessarily a problem.\n";
print STDERR "Distros with distro option sets are:\n";
my $dirh;
opendir ($dirh, "distro-configs");
opendir ($dirh, "$src_path/distro-configs");
while (($_ = readdir ($dirh))) {
/(.*)\.conf$/ || next;
print STDERR "\t$1\n";
......@@ -104,7 +116,7 @@ if (!@ARGV) {
}
my @args;
my $default_config = "distro-configs/default.conf";
my $default_config = "$src_path/distro-configs/default.conf";
if (-f $default_config) {
print STDERR "Reading default config file: $default_config\n";
push @args, read_args ($default_config);
......@@ -113,7 +125,7 @@ for my $arg (@cmdline_args) {
if ($arg eq '--clean') {
clean();
} elsif ($arg =~ m/--with-distro=(.*)$/) {
my $config = "distro-configs/$1.conf";
my $config = "$src_path/distro-configs/$1.conf";
if (! -f $config) {
invalid_distro ($config, $1);
} else {
......@@ -137,26 +149,21 @@ chomp $system;
sanity_checks ($system) unless($system eq 'Darwin');
# since this looks crazy, if you have a symlink on a path up to and including
# the current directory, we need our configure to run in the realpath of that
# such that compiled (realpath'd) dependency filenames match the filenames
# used in our makefiles - ie. this gets dependencies right via SRC_ROOT
my $cwd_str = realpath(cwd());
chdir ($cwd_str);
# more amazingly, if you don't clobber 'PWD' shells will re-assert their
# old path from the environment, not cwd.
$ENV{PWD} = $cwd_str;
my $aclocal_flags = $ENV{ACLOCAL_FLAGS};
$aclocal_flags .= " -I ./m4";
$aclocal_flags .= " -I ./m4/mac" if ($system eq 'Darwin');
$aclocal_flags .= " -I $src_path/m4";
$aclocal_flags .= " -I $src_path/m4/mac" if ($system eq 'Darwin');
$ENV{AUTOMAKE_EXTRA_FLAGS} = '--warnings=no-portability' if (!($system eq 'Darwin'));
if ($src_path ne $build_path)
{
system ("ln -sf $src_path/configure.ac configure.ac");
system ("ln -sf $src_path/g g");
}
system ("$aclocal $aclocal_flags") && die "Failed to run aclocal";
unlink ("configure");
system ("autoconf") && die "Failed to run autoconf";
system ("autoconf -I ${src_path}") && die "Failed to run autoconf";
die "failed to generate configure" if (! -f "configure");
if (defined $ENV{NOCONFIGURE}) {
......@@ -188,6 +195,8 @@ if (defined $ENV{NOCONFIGURE}) {
open (my $fh, ">autogen.lastrun") || die "can't create autogen.lastrun";
close ($fh);
}
push @args, "--srcdir=$src_path";
print "running ./configure with '" . join ("' '", @args), "'\n";
system ("./configure", @args) && die "Error running configure";
}
......
......@@ -4,7 +4,6 @@ dnl in order to create a configure script.
AC_INIT([LibreOffice],[4.1],[],[],[http://documentfoundation.org/])
AC_PREREQ([2.59])
save_CC=$CC
save_CXX=$CXX
......@@ -87,16 +86,20 @@ AC_PROG_EGREP
# AC_PROG_EGREP doesn't set GREP on all systems as well
AC_PATH_PROG(GREP, grep)
BUILD_DIR=`pwd`
cd $srcdir
SRC_ROOT=`pwd`
cd $BUILD_DIR
EXEEXT_FOR_BUILD=
x_Cygwin=[\#]
if test "$build_os" = "cygwin"; then
EXEEXT_FOR_BUILD=.exe
SRC_ROOT=`pwd`
PathFormat "$SRC_ROOT"
SRC_ROOT="$formatted_path"
PathFormat "$BUILD_DIR"
BUILD_DIR="$formatted_path"
x_Cygwin=
else
EXEEXT_FOR_BUILD=
SRC_ROOT=`pwd`
x_Cygwin=[\#]
fi
AC_SUBST(SRC_ROOT)
......@@ -2406,7 +2409,7 @@ if test -n "${with_solver_and_workdir_root}"; then
SOLARVER=${formatted_path}/solver
fi
else
SOLARVER=${SRC_ROOT}/solver
SOLARVER=${BUILD_DIR}/solver
fi
dnl ===================================================================
......@@ -4031,7 +4034,7 @@ if test -n "${with_solver_and_workdir_root}"; then
WORKDIR=${formatted_path}/workdir/${INPATH}
fi
else
WORKDIR=${SRC_ROOT}/workdir/${INPATH}
WORKDIR=${BUILD_DIR}/workdir/${INPATH}
fi
OUTDIR="${SOLARVER}/${INPATH}"
SOLARINC="-I. -I${SOLARVER}/$INPATH/inc/external -I${SOLARVER}/$INPATH/inc -I$SRC_ROOT/solenv/inc $SOLARINC"
......@@ -4145,9 +4148,9 @@ if test "$cross_compiling" = "yes"; then
config_host.mk.in \
configure \
bin/get_config_variables \
solenv/bin/getcompver.awk \
solenv/inc/langlist.mk \
solenv/inc/postset.mk \
$srcdir/solenv/bin/getcompver.awk \
$SRC_ROOT/solenv/inc/langlist.mk \
$SRC_ROOT/solenv/inc/postset.mk \
| (cd CONF-FOR-BUILD && tar xf -)
(
unset COM GUI GUIBASE OS CPU CPUNAME
......@@ -11824,7 +11827,7 @@ AC_MSG_CHECKING([which languages to be built])
# + adds " at the end of the value
# + removes en-US; we want to put it on the beginning
# + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
[eval $(sed -e :a -e '/\\$/N; s/\\\n//; ta' -n -e 's/=/="/;s/\([^\\]\)$/\1"/;s/en-US//;/^completelangiso/p' solenv/inc/langlist.mk)]
[eval $(sed -e :a -e '/\\$/N; s/\\\n//; ta' -n -e 's/=/="/;s/\([^\\]\)$/\1"/;s/en-US//;/^completelangiso/p' $SRC_ROOT/solenv/inc/langlist.mk)]
ALL_LANGS="en-US $completelangiso"
# check the configured localizations
WITH_LANG="$with_lang"
......@@ -12511,7 +12514,7 @@ else
echo > config_host.mk.last
fi
AC_CONFIG_FILES([config_host.mk])
AC_CONFIG_FILES([config_host.mk Makefile])
AC_CONFIG_HEADERS([config/config_global.h])
AC_CONFIG_HEADERS([config/config_telepathy.h])
AC_CONFIG_HEADERS([config/config_vclplug.h])
......
......@@ -10,9 +10,16 @@ fi
SUBMODULES_ALL="dictionaries helpcontent2 translations"
pushd $(dirname $0) > /dev/null
COREDIR=$(pwd)
if [ -f config_host.mk ] ; then
# we are in the BUILD_DIR
SRC_ROOT=$(cat ${BUILD_DIR}/config_host.mk | grep SRC_ROOT | sed -e "s/.*=//")
else
SRC_ROOT=$(pwd)
fi
popd > /dev/null
COREDIR="$SRC_ROOT"
usage()
{
git
......@@ -114,8 +121,8 @@ local repo
get_configured_submodules()
{
SUBMODULES_CONFIGURED=""
if [ -f "config_host.mk" ] ; then
SUBMODULES_CONFIGURED=$(cat config_host.mk | grep GIT_NEEDED_SUBMODULES | sed -e "s/.*=//")
if [ -f "${BUILD_DIR}/config_host.mk" ] ; then
SUBMODULES_CONFIGURED=$(cat ${BUILD_DIR}/config_host.mk | grep GIT_NEEDED_SUBMODULES | sed -e "s/.*=//")
else
# if we need the configured submoduel before the configuration is done. we assumed you want them all
SUBMODULES_CONFIGURED=${SUBMODULES_ALL?}
......
......@@ -31,10 +31,10 @@ $(call gb_CustomTarget_get_target,scp2/macros) : $(call gb_CustomTarget_get_work
$(call gb_CustomTarget_get_workdir,scp2/macros)/langmacros.inc :| $(call gb_CustomTarget_get_workdir,scp2/macros)/.dir
$(call gb_CustomTarget_get_workdir,scp2/macros)/langmacros.inc : $(SRCDIR)/scp2/macros/macro.pl $(SRCDIR)/config_host.mk.stamp
$(call gb_CustomTarget_get_workdir,scp2/macros)/langmacros.inc : $(SRCDIR)/scp2/macros/macro.pl $(BUILD_DIR)/config_host.mk.stamp
$(call gb_Helper_abbreviate_dirs,\
export COMPLETELANGISO_VAR='$(gb_ScpTemplateTarget_LANGS)' && \
$(PERL) $< -verbose -o $@ -c $(SRCDIR)/config_host.mk.stamp \
$(PERL) $< -verbose -o $@ -c $(BUILD_DIR)/config_host.mk.stamp \
)
# vim: set shiftwidth=4 tabstop=4 noexpandtab:
......@@ -189,7 +189,7 @@
my $incompatible = 0;
my $local_host_ip = 'localhost';
my $tail_build_modules_mk = "$ENV{SOLARENV}/gbuild/tail_build_modules.mk";
my $tail_build_module_dir = $ENV{"SRCDIR"};
my $tail_build_module_dir = $ENV{"SRC_ROOT"};
my $tail_build_prj = "tail_build";
my $cross_tail_build_prj = "cross_tail_build";
my $total_modules = 0;
......
......@@ -157,7 +157,7 @@ gb_DEBUG_CXXFLAGS := $(FNO_DEFAULT_INLINE)
gb_LinkTarget_INCLUDE :=\
$(subst -I. , ,$(SOLARINC)) \
-I$(SRCDIR)/config \
-I$(BUILD_DIR)/config \
ifeq ($(COM_GCC_IS_CLANG),TRUE)
ifeq ($(COMPILER_PLUGIN_TOOL),)
......
......@@ -162,7 +162,7 @@ gb_LinkTarget_CXXFLAGS := $(gb_CXXFLAGS)
gb_LinkTarget_INCLUDE :=\
$(subst -I. , ,$(SOLARINC)) \
$(foreach inc,$(subst ;, ,$(JDKINC)),-I$(inc)) \
-I$(SRCDIR)/config \
-I$(BUILD_DIR)/config \
gb_LinkTarget_get_pdbfile = $(call gb_LinkTarget_get_target,)pdb/$(1).pdb
......
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