libreoffice/build_prepare.inc
2013-04-17 12:53:49 +00:00

80 lines
2.6 KiB
PHP

%if %prepare_build != 0
# first build make-3.82
%if 0%{?suse_version} < 01230
cd make-*
CFLAGS=$RPM_OPT_FLAGS ./configure
make %{?_smp_mflags}
cd -
%endif
# second build zip-3.0 on older distributions
%if %suse_version < 1140
cd zip30
make %{?jobs:-j%jobs} -f unix/Makefile prefix=/usr CC="gcc $RPM_OPT_FLAGS -DLARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" generic_gcc
cd -
%endif
#
# Parallel build settings ...
lo_jobs="%{?jobs:%jobs}"
%ifarch %arm
%if ! 0%{?qemu_user_space_build:1}
# native hardware is not that powerful
lo_jobs="1"
%endif
%endif
# do not eat all memory
echo "Available memory:"
free
echo "System limits:"
ulimit -a
lo_jobs_reduced=
if test -n "$lo_jobs" -a "$lo_jobs" -gt 1 ; then
if test `uname -i` = "x86_64" ; then
mem_per_process=1000
else
mem_per_process=600
fi
%if 0%{?qemu_user_space_build:1}
mem_per_process=1200
%endif
max_mem=`LANG=C free -t -m | sed -n "s|^Mem: *\([0-9]*\).*$|\1|p"`
max_jobs="$(($max_mem / $mem_per_process))"
test "$lo_jobs" -gt "$max_jobs" && lo_jobs="$max_jobs" && lo_jobs_reduced="yes" && echo "Warning: Reducing number of jobs to $max_jobs because of memory limits"
test "$lo_jobs" -le 0 && lo_jobs=1 && echo "Warning: Do not use the parallel build at all becuse of memory limits"
fi
# finally set jobs
PARALLEL_BUILD=
if test -n "$lo_jobs" ; then
PARALLEL_BUILD="--with-parallelism=$lo_jobs"
fi
# using icecream
if test -e "/opt/icecream/bin/gcc" -a -e "/opt/icecream/bin/g++" ; then
PARALLEL_BUILD="$PARALLEL_BUILD --enable-icecream"
fi
%endif
# make sure that JAVA_HOME is set correctly
%if 0%{?suse_version}
source /etc/profile.d/alljava.sh
%endif
# use RPM_OPT_FLAGS, ...
# FIXME: -fno-omit-frame-pointer is needed in LO-4.0; the order of compliation flags is already fixed in master for LO-4.1
# The current situation causes build (bridge test) failure on i586 systems
ARCH_FLAGS="`echo $RPM_OPT_FLAGS | sed -e 's/\-fexceptions//g'` -fno-strict-aliasing -fno-omit-frame-pointer"
CFLAGS="$ARCH_FLAGS"
CXXFLAGS="$ARCH_FLAGS"
export ARCH_FLAGS CFLAGS CXXFLAGS
# FIXME: genccode from the system icu is in /usr/sbin
# FIXME: we need make-3.82 for parallel build
%if 0%{?suse_version} < 01230
export PATH="$RPM_BUILD_DIR/libreoffice-%version/make-%gnu_make_version-gbuild:$PATH:/usr/sbin"
%endif
# use the extra built zip-3.0 on older distributions
%if %suse_version < 1140
export PATH="$RPM_BUILD_DIR/libreoffice-%version/zip30:$PATH"
%endif
# Whack in our python2 so we don't have to use internal one
# which is quite nightmare.
export PYTHON=/usr/bin/python
export PYTHON_CFLAGS=`pkg-config --cflags python`
export PYTHON_LIBS=`pkg-config --libs python`