summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/pack-debug195
-rw-r--r--config_host.mk.in1
-rw-r--r--configure.ac1
-rw-r--r--solenv/bin/modules/installer.pm53
-rw-r--r--solenv/bin/modules/installer/environment.pm3
-rw-r--r--solenv/bin/modules/installer/epmfile.pm20
-rw-r--r--solenv/bin/modules/installer/splitdbg.pm121
7 files changed, 388 insertions, 6 deletions
diff --git a/bin/pack-debug b/bin/pack-debug
new file mode 100755
index 000000000000..70e3f80c7ed4
--- /dev/null
+++ b/bin/pack-debug
@@ -0,0 +1,195 @@
+#!/bin/bash
+#
+# 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/.
+#
+# create debuginfo and debugsource packages from LO rpm & deb files
+# (generated by using --enable-symbols)
+
+# build path
+export BUILD_PATH=$PWD
+export BUILD_LOG=$BUILD_PATH/pack-debug.log
+
+if type -P pigz &>/dev/null; then
+ GZIP=pigz
+else
+ GZIP=gzip
+fi
+
+if [ $# -gt 0 ]
+then
+ for i in "$@"
+ do
+ case $i in
+--only-rpm) ONLY_RPM=1;;
+--only-deb) ONLY_DEB=1;;
+*) echo "Usage: pack-debug [--only-rpm | --only-deb]" && exit 1;;
+ esac
+ done
+fi
+
+# set install dirname and product version
+if [ ! -f config.log ]; then
+ echo "config.log not found. Run this script from build root."
+ exit 1;
+fi
+
+# create pack-debug.log file
+echo create debug packages >$BUILD_LOG
+
+eval $(grep ^INSTALLDIRNAME config.log)
+
+# set package base name, eg. collaboraoffice
+DEBUGSRC_PACKAGENAME=$INSTALLDIRNAME
+
+#################################
+# Function for re-build RPM files
+#################################
+function repack_rpm {
+
+# set environment based on config.log
+# for find-requires-x11.sh used by rpm __find_requires
+eval $(grep ^PLATFORMID config.log)
+export PLATFORMID
+eval $(grep ^build_cpu config.log)
+export build_cpu
+
+####################################
+echo create RPM debug source package
+####################################
+
+DEBUGSRC="$(find workdir -name ${DEBUGSRC_PACKAGENAME}.spec.log)"
+
+# create spec file, based on the spec file of the brand package
+
+cat $DEBUGSRC | awk '
+ /^Name:/ { print "Summary: Debug source for package "$2; print $0"-debugsource";next }
+ /^Group:/ { print $1" Development/Debug";next }
+ /^Brand module/ { print gensub("Brand module", "Source files", "");next }
+ /^%attr/ || /^Summary:/ { next }
+ {print}
+ END {
+ print "%defattr(-,root,root)"
+ }
+ ' > ${DEBUGSRC}-debugsource
+ buildroot=$(cat $DEBUGSRC-debugsource | awk '/^BuildRoot/{print$2}')
+ topdir=$(dirname $(dirname $buildroot))
+ mkdir -p $buildroot $topdir/RPMS/BUILD $topdir/RPMS/RPMS
+ rm -rf $buildroot
+
+ # create source file list
+
+ find $BUILD_PATH -name '*[.][hc]xx' -o -name '*[.][hc]' | grep -Ev '/(instdir|qa|DEBS)/' |
+
+ # list all directories for complete rpm remove
+
+ awk -v home=$BUILD_PATH '
+ {
+ split($0, a, home "/")
+ n=split(a[2], b, "/")
+ c=home
+ for(i=1;i<n;i++) {
+ c=c"/"b[i]
+ if(mem[c]!=1) print "%dir "c
+ mem[c]=1
+ }
+ print $0
+ }' >> ${DEBUGSRC}-debugsource
+
+ # start rpmbuild for debug source package
+
+ ln -s / $buildroot
+
+ # debug build source package
+
+ rpmbuild -bb --define "_unpackaged_files_terminate_build 0" --define "_binary_payload w1T.xzdio" ${DEBUGSRC}-debugsource --target $build_cpu --buildroot=$buildroot
+
+
+echo Update RPM download tar.gz
+rpmdir=$(echo $topdir | sed 's/_inprogress$//')
+mv $topdir/RPMS/RPMS/*/*.rpm $rpmdir/RPMS/
+cd $rpmdir/..
+TARGET_RPM=$(ls *_download/*.tar.gz)
+TARGET_DEBUG=$(echo $TARGET_RPM | sed 's/.tar.gz$/-debug.tar.gz/')
+SOURCE_RPM=$(find *_rpm -type f | grep -v debug)
+SOURCE_DEBUG=$(find *_rpm -type f | grep -E '(debug|readme|README)')
+tar c $SOURCE_RPM | $GZIP >$TARGET_RPM
+tar c $SOURCE_DEBUG | $GZIP >$TARGET_DEBUG
+cd $BUILD_PATH
+rm -rf $topdir
+}
+
+#################################
+# Function for re-build DEB files
+#################################
+function repack_deb {
+
+####################################
+echo create DEB debug source package
+####################################
+
+DEBUGSRC=$BUILD_PATH/workdir/installation/CollaboraOffice/deb/listfile/en-US/epm_gid_Module_Root_Brand.lst
+
+echo Base spec file: $DEBUGSRC
+
+# create spec file, based on the spec file of the brand package
+
+cat $DEBUGSRC | awk '
+ /^%product/ { print gensub("Brand module", "Debug source package", "", $0) ;next }
+ /^%description/ { print gensub("Brand module", "Debug source package", "", $0) ;next }
+ /^[cdf] / { next }
+ {print}
+ ' > ${DEBUGSRC}-debugsource
+
+ # create source file list
+
+ find $BUILD_PATH -name '*[.][hc]xx' -o -name '*[.][hc]' | grep -Ev '/(instdir|qa|DEBS)/' |
+
+ # list all directories
+
+ awk -v home=$BUILD_PATH '
+ {
+ split($0, a, home "/")
+ n=split(a[2], b, "/")
+ c=home
+ for(i=1;i<n;i++) {
+ c=c"/"b[i]
+ if(mem[c]!=1) print "d 755 root root "c" -"
+ mem[c]=1
+ }
+ print "f 644 root root "$0" "$0
+ }' >> ${DEBUGSRC}-debugsource
+
+ echo Spec file of debug source package: ${DEBUGSRC}-debugsource
+
+ # debug build source package
+
+ $BUILD_PATH/workdir/UnpackedTarball/epm/epm -f deb -g ${INSTALLDIRNAME}-debugsource ${DEBUGSRC}-debugsource --output-dir DEBS -v
+
+echo Update DEB download tar.gz
+
+debdir=$(ls -d $BUILD_PATH/workdir/installation/CollaboraOffice/deb/install/*_deb)
+mv $BUILD_PATH/DEBS/*.deb $debdir/DEBS/
+cd $debdir/..
+TARGET_DEB=$(ls *_download/*.tar.gz)
+TARGET_DEBUG=$(echo $TARGET_DEB | sed 's/.tar.gz$/-debug.tar.gz/')
+SOURCE_DEB=$(find *_deb -type f | grep -v debug)
+SOURCE_DEBUG=$(find *_deb -type f | grep -E '(debug|readme|README)')
+tar c $SOURCE_DEB | $GZIP >$TARGET_DEB
+tar c $SOURCE_DEBUG | $GZIP >$TARGET_DEBUG
+
+cd $BUILD_PATH
+rm -rf DEBS
+}
+
+# start deb re-build
+test -z "$ONLY_RPM" -a "$(find workdir/installation/CollaboraOffice/deb/listfile -name '*.lst')" != "" && repack_deb >$BUILD_LOG 2>&1 || \
+ echo 'Skip DEB debug package generation (--only-rpm or missing EPM lst files).'
+
+# start rpm re-build
+test -z "$ONLY_DEB" -a "$(find workdir -name '*spec.log')" != "" && repack_rpm >>$BUILD_LOG 2>&1 || \
+ echo 'Skip RPM debug package generation (--only-deb or missing RPM spec files).'
+
diff --git a/config_host.mk.in b/config_host.mk.in
index 2ac32c263dc2..8674ccc0f077 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -133,6 +133,7 @@ export DICT_SYSTEM_DIR=@DICT_SYSTEM_DIR@
export DISABLE_CVE_TESTS=@DISABLE_CVE_TESTS@
export DISABLE_DYNLOADING=@DISABLE_DYNLOADING@
export DISABLE_PYTHON=@DISABLE_PYTHON@
+export DLOPEN_LIBS=@DLOPEN_LIBS@
export DOCDIR=@DOCDIR@
export DOXYGEN=@DOXYGEN@
export DO_FETCH_TARBALLS=@DO_FETCH_TARBALLS@
diff --git a/configure.ac b/configure.ac
index 10db59f7bc51..9d5d806b0ed2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5011,7 +5011,6 @@ else
AC_MSG_RESULT([for "$enable_symbols"])
fi
AC_SUBST(ENABLE_SYMBOLS_FOR)
-
if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
# Building on Android with full symbols: without enough memory the linker never finishes currently.
AC_MSG_CHECKING([whether enough memory is available for linking])
diff --git a/solenv/bin/modules/installer.pm b/solenv/bin/modules/installer.pm
index a22385924b92..64d18254e777 100644
--- a/solenv/bin/modules/installer.pm
+++ b/solenv/bin/modules/installer.pm
@@ -48,6 +48,7 @@ use installer::scpzipfiles;
use installer::scriptitems;
use installer::setupscript;
use installer::simplepackage;
+use installer::splitdbg qw(splitdbg_libraries);
use installer::strip qw(strip_libraries);
use installer::systemactions;
use installer::windows::assembly;
@@ -1044,6 +1045,7 @@ sub run {
strip_libraries($filesinpackage, $languagestringref);
}
+
if ( $installer::globals::simple ) {
installer::worker::install_simple($onepackagename, $$languagestringref, $dirsinpackage, $filesinpackage, $linksinpackage, $unixlinksinpackage);
}
@@ -1055,16 +1057,37 @@ sub run {
# Example for a link: l 000 root sys /usr/bin/linkname filename
# The source field specifies the file to link to
+ # check if we have to create a debug info package
+ my $dbg = 0;
+ my $debugfilelist;
+ if ( !($installer::globals::strip) )
+ {
+ $debugfilelist = splitdbg_libraries($filesinpackage, $languagestringref);
+ if ( $#{$debugfilelist} > -1 )
+ {
+ $dbg = 1;
+ }
+ }
+
my $epmfilename = "epm_" . $onepackagename . ".lst";
+ my $dbgepmfilename = "epm_" . $onepackagename . ".debug.lst";
installer::logger::print_message( "... creating epm list file $epmfilename ... \n" );
+ if ($dbg)
+ {
+ installer::logger::print_message( "... creating epm list file $dbgepmfilename ... \n" );
+ }
my $completeepmfilename = $listfiledir . $installer::globals::separator . $epmfilename;
+ my $completedbgepmfilename = $listfiledir . $installer::globals::separator . $dbgepmfilename;
+
my @epmfile = ();
+ my @dbgepmfile = ();
my $epmheaderref = installer::epmfile::create_epm_header($allvariableshashref, $filesinproductlanguageresolvedarrayref, $languagesarrayref, $onepackage);
installer::epmfile::adding_header_to_epm_file(\@epmfile, $epmheaderref);
+ my $dbgepmheaderref;
# adding directories, files and links into epm file
@@ -1093,6 +1116,17 @@ sub run {
installer::epmfile::resolve_path_in_epm_list_before_packaging(\@epmfile, $completeepmfilename, "UREPACKAGEPREFIX", $allvariableshashref->{'UREPACKAGEPREFIX'});
installer::files::save_file($completeepmfilename ,\@epmfile);
+ if ($dbg)
+ {
+ $onepackage->{'packagename'} .= "-debuginfo";
+ $onepackage->{'description'} .= " (debug info)";
+ $dbgepmheaderref = installer::epmfile::create_epm_header($allvariableshashref, $filesinproductlanguageresolvedarrayref, $languagesarrayref, $onepackage);
+ installer::epmfile::adding_header_to_epm_file(\@dbgepmfile, $dbgepmheaderref);
+ installer::epmfile::put_directories_into_epmfile($dirsinpackage, \@dbgepmfile, $allvariableshashref, $packagerootpath);
+ installer::epmfile::put_files_into_dbgepmfile($debugfilelist, \@dbgepmfile );
+ installer::files::save_file($completedbgepmfilename ,\@dbgepmfile);
+ }
+
{
# changing into the "install" directory to create installation sets
@@ -1135,9 +1169,18 @@ sub run {
# Install: rpm -i --prefix=/opt/special --nodeps so8m35.rpm
installer::epmfile::create_new_directory_structure($newepmdir);
- $installer::globals::postprocess_specialepm = 1;
- # solaris patch not needed anymore
+ # package the debug info if required
+
+ if ($dbg)
+ {
+ installer::epmfile::call_epm($epmexecutable, $completedbgepmfilename, $packagename . "-debuginfo", $includepatharrayref);
+ my $newdbgepmdir = installer::epmfile::prepare_packages($loggingdir, $packagename . "-debuginfo", $staticpath, $relocatablepath, $onepackage, $allvariableshashref, $debugfilelist, $languagestringref);
+ installer::epmfile::create_packages_without_epm($newdbgepmdir, $packagename . "-debuginfo", $includepatharrayref, $allvariableshashref, $languagestringref);
+ installer::epmfile::remove_temporary_epm_files($newdbgepmdir, $loggingdir, $packagename . "-debuginfo");
+ installer::epmfile::create_new_directory_structure($newdbgepmdir);
+ }
+ $installer::globals::postprocess_specialepm = 1;
}
}
@@ -1159,7 +1202,11 @@ sub run {
installer::logger::print_message( "... starting unpatched epm ... \n" );
}
- if ( $installer::globals::call_epm ) { installer::epmfile::call_epm($epmexecutable, $completeepmfilename, $packagename, $includepatharrayref); }
+ installer::epmfile::call_epm($epmexecutable, $completeepmfilename, $packagename, $includepatharrayref);
+ if ($dbg)
+ {
+ installer::epmfile::call_epm($epmexecutable, $completedbgepmfilename, $packagename . "-debuginfo", $includepatharrayref);
+ }
if (($installer::globals::isrpmbuild) || ($installer::globals::issolarispkgbuild) || ($installer::globals::debian))
{
diff --git a/solenv/bin/modules/installer/environment.pm b/solenv/bin/modules/installer/environment.pm
index 42861e6ac080..c2add9cadb41 100644
--- a/solenv/bin/modules/installer/environment.pm
+++ b/solenv/bin/modules/installer/environment.pm
@@ -123,8 +123,7 @@ sub set_global_environment_variables
if ( $ENV{'RPM'} ) { $installer::globals::rpm = $ENV{'RPM'}; }
if ( $ENV{'DONTCOMPRESS'} ) { $installer::globals::solarisdontcompress = 1; }
if ( $ENV{'IGNORE_ERROR_IN_LOGFILE'} ) { $installer::globals::ignore_error_in_logfile = 1; }
- if (( $ENV{'ENABLE_STRIP'} ) && ( $ENV{'ENABLE_STRIP'} ne '' )) { $installer::globals::strip = 1; }
- if (( $ENV{'DISABLE_STRIP'} ) && ( $ENV{'DISABLE_STRIP'} ne '' )) { $installer::globals::strip = 0; }
+ if (!( $ENV{'ENABLE_SYMBOLS_FOR'} ) || !( $ENV{'ENABLE_SYMBOLS_FOR'} ne '' )) { $installer::globals::strip = 1; } # it is 0 by default
if ( $installer::globals::localinstalldir ) { $installer::globals::localinstalldirset = 1; }
# Special handling, if LOCALINSTALLDIR contains "~" in the path
diff --git a/solenv/bin/modules/installer/epmfile.pm b/solenv/bin/modules/installer/epmfile.pm
index 0b2caf1fff37..2bdc79599d52 100644
--- a/solenv/bin/modules/installer/epmfile.pm
+++ b/solenv/bin/modules/installer/epmfile.pm
@@ -199,6 +199,26 @@ sub put_files_into_epmfile
}
}
+sub put_files_into_dbgepmfile
+{
+ my ($filesinproductarrayref, $epmfileref) = @_;
+
+ for ( my $i = 0; $i <= $#{$filesinproductarrayref}; $i++ )
+ {
+ my $onefile = ${$filesinproductarrayref}[$i];
+
+ my $unixrights = $onefile->{'UnixRights'};
+ my $destination = $onefile->{'destination'} . ".dbg";
+ my $sourcepath = $onefile->{'sourcepath'} . ".dbg";
+ my $filetype = "f";
+ my $group = "root";
+
+ my $line = "$filetype $unixrights root $group $destination $sourcepath\n";
+
+ push(@{$epmfileref}, $line);
+ }
+}
+
sub put_links_into_epmfile
{
my ($linksinproductarrayref, $epmfileref) = @_;
diff --git a/solenv/bin/modules/installer/splitdbg.pm b/solenv/bin/modules/installer/splitdbg.pm
new file mode 100644
index 000000000000..60c0c1bde024
--- /dev/null
+++ b/solenv/bin/modules/installer/splitdbg.pm
@@ -0,0 +1,121 @@
+#
+# 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/.
+#
+
+package installer::splitdbg;
+
+use strict;
+use warnings;
+
+use base 'Exporter';
+
+use installer::globals;
+use installer::logger;
+use installer::pathanalyzer;
+use installer::systemactions;
+
+our @EXPORT_OK = qw(splitdbg_libraries);
+
+sub _need_to_splitdbg
+{
+ my ( $filename ) = @_;
+
+ my $splitdbg = 0;
+
+ # Check using the "file" command
+
+ $filename =~ s/'/'\\''/g;
+ open (FILE, "file '$filename' |");
+ my $fileoutput = <FILE>;
+ close (FILE);
+
+ if (( $fileoutput =~ /not stripped/i ) && ( $fileoutput =~ /\bELF\b/ )) { $splitdbg = 1; }
+
+ return $splitdbg;
+}
+
+sub _do_splitdbg
+{
+ my ( $filename ) = @_;
+
+ my $systemcall = "objcopy --only-keep-debug $filename $filename.dbg && ";
+ $systemcall .= "objcopy --strip-debug $filename && ";
+ $systemcall .= "objcopy --add-gnu-debuglink=$filename.dbg $filename";
+
+ my $returnvalue = system($systemcall);
+
+ my $infoline = "Systemcall: $systemcall\n";
+ push( @installer::globals::logfileinfo, $infoline);
+
+ if ($returnvalue)
+ {
+ $infoline = "ERROR: Could not split debug info of $filename!\n";
+ push( @installer::globals::logfileinfo, $infoline);
+ }
+ else
+ {
+ $infoline = "SUCCESS: Split debug info of $filename!\n";
+ push( @installer::globals::logfileinfo, $infoline);
+ }
+}
+
+sub splitdbg_libraries
+{
+ my ( $filelist, $languagestringref ) = @_;
+
+ my @debugfilelist = ();
+
+ installer::logger::include_header_into_logfile("Splitting debuginfo from files:");
+
+ my $splitdbgdirbase = installer::systemactions::create_directories("splitdbg", $languagestringref);
+
+ if (! grep {$_ eq $splitdbgdirbase} @installer::globals::removedirs)
+ {
+ push(@installer::globals::removedirs, $splitdbgdirbase);
+ }
+
+ for ( my $i = 0; $i <= $#{$filelist}; $i++ )
+ {
+ my $sourcefilename = ${$filelist}[$i]->{'sourcepath'};
+
+ if ( _need_to_splitdbg($sourcefilename) )
+ {
+ my $shortfilename = $sourcefilename;
+ installer::pathanalyzer::make_absolute_filename_to_relative_filename(\$shortfilename);
+
+ my $infoline = "Split debuginfo: $shortfilename\n";
+ push(@installer::globals::logfileinfo, $infoline);
+
+ # copy file into directory for split debuginfo libraries
+
+ my $onelanguage = ${$filelist}[$i]->{'specificlanguage'};
+
+ # files without language into directory "00"
+
+ if ($onelanguage eq "") { $onelanguage = "00"; }
+
+ my $splitdbgdir = $splitdbgdirbase . $installer::globals::separator . $onelanguage;
+ installer::systemactions::create_directory($splitdbgdir); # creating language specific subdirectories
+
+ my $destfilename = $splitdbgdir . $installer::globals::separator . $shortfilename;
+ installer::systemactions::copy_one_file($sourcefilename, $destfilename);
+
+ # change sourcepath in files collector
+
+ ${$filelist}[$i]->{'sourcepath'} = $destfilename;
+
+ # split debuginfo from file
+
+ _do_splitdbg($destfilename);
+
+ push(@debugfilelist, ${$filelist}[$i]);
+ }
+ }
+ return \@debugfilelist;
+}
+
+1;