diff --git a/bin/cygport.in b/bin/cygport.in index 32e7dd1..b3d953b 100755 --- a/bin/cygport.in +++ b/bin/cygport.in @@ -589,6 +589,23 @@ declare -r src_patchfile=${PF}.src.patch; declare -ar pkg_name=(${PKG_NAMES:-${PN}}); declare -r pkg_count=${#pkg_name[*]}; +# this requires S and B to be already defined +if ! defined _CYGPORT_RESTRICT_debuginfo_ +then + for flags in {C,CXX,F,FC,GCJ,GO,OBJC,OBJCXX}FLAGS + do + for map in ${DEBUG_PREFIX_MAPS[*]} + do + declare ${flags}+=" -fdebug-prefix-map=${map}=/usr/src/debug/${PF}" + done + declare ${flags}+=" -fdebug-prefix-map==/usr/src/debug/${PF}/" + declare ${flags}+=" -fdebug-prefix-map=/usr=/usr" + declare ${flags}+=" -fdebug-prefix-map=${B}=/usr/src/debug/${PF}" + declare ${flags}+=" -fdebug-prefix-map=${S}=/usr/src/debug/${PF}" + done + unset flags map +fi + ################################################################################ # # Command processing diff --git a/cygclass/qt4-qmake.cygclass b/cygclass/qt4-qmake.cygclass index 521b0a3..452f02e 100644 --- a/cygclass/qt4-qmake.cygclass +++ b/cygclass/qt4-qmake.cygclass @@ -49,8 +49,12 @@ cygqmake4() { error "libQtCore4-devel is required to build this package" fi - ${QT4_QMAKE} -spec ${QMAKESPEC} -recursive ${CYGQMAKE4_ARGS} ${@} \ - || error "qmake failed" + ${QT4_QMAKE} -spec ${QMAKESPEC} -recursive \ + QMAKE_CFLAGS_RELEASE="${CFLAGS}" \ + QMAKE_CXXFLAGS_RELEASE="${CXXFLAGS}" \ + QMAKE_STRIP=: \ + ${CYGQMAKE4_ARGS} ${@} \ + || error "qmake failed" } #****C* qt4-qmake.cygclass/qt4_qmake_compile diff --git a/lib/compilers.cygpart b/lib/compilers.cygpart index c543218..29882aa 100644 --- a/lib/compilers.cygpart +++ b/lib/compilers.cygpart @@ -33,7 +33,7 @@ declare -x CC="gcc"; # DEFAULT VALUE # -g -O2 -pipe #**** -declare -x CFLAGS="-g -O2 -pipe "; +declare -x CFLAGS="-ggdb -O2 -pipe"; #****v* Compiling/CPPFLAGS # DESCRIPTION diff --git a/lib/pkg_pkg.cygpart b/lib/pkg_pkg.cygpart index b645255..2952682 100644 --- a/lib/pkg_pkg.cygpart +++ b/lib/pkg_pkg.cygpart @@ -128,7 +128,7 @@ __pkg_binpkg() { if defined pkg_contents then - tar jcvf ${top}/${pkg_name[${n}]}-${PVR}.tar.bz2 ${pkg_contents} \ + tar jcvf ${top}/${pkg_name[${n}]}-${PVR}.tar.bz2 --exclude=usr/lib/debug --exclude=usr/src ${pkg_contents} \ || error "Binary package creation failed: ${pkg_name[${n}]}" else inform "Creating empty package" @@ -138,6 +138,17 @@ __pkg_binpkg() { echo; n+=1; done + + if [ -d ${D}/usr/lib/debug -a -d ${D}/usr/src/debug ] + then + __step "${PN}-debuginfo-${PVR}.tar.bz2"; + tar jcvf ${top}/${PN}-debuginfo-${PVR}.tar.bz2 usr/lib/debug/ usr/src/debug/ \ + || error "Debuginfo package creation failed: ${PN}-debuginfo" + echo; + else + inform "No debug files, skipping debuginfo subpackage" + echo; + fi } __pkg_pkgcheck() { @@ -156,6 +167,11 @@ __pkg_pkgcheck() { n+=1 done + if [ -f ${top}/${PN}-debuginfo-${PVR}.tar.bz2 ] + then + tar tjf ${top}/${PN}-debuginfo-${PVR}.tar.bz2 | grep -Ev "/$" >> ${tmp1} + fi + #****v* Packaging/PKG_IGNORE # DESCRIPTION # A list of files that should not be included in any package, in the same @@ -470,6 +486,28 @@ __pkg_dist() { n+=1; done + if [ -f ${top}/${PN}-debuginfo-${PVR}.tar.bz2 ] + then + mkdir -p ${distdir}/${PN}/${PN}-debuginfo + cp ${top}/${PN}-debuginfo-${PVR}.tar.bz2 ${distdir}/${PN}/${PN}-debuginfo/ + + if [ -f ${C}/${PN}-debuginfo.hint ] + then + cp ${C}/${PN}-debuginfo.hint ${distdir}/${PN}/${PN}-debuginfo/setup.hint + elif [ -f ${C}/debuginfo.hint ] + then + cp ${C}/debuginfo.hint ${distdir}/${PN}/${PN}-debuginfo/setup.hint + else + cat > ${distdir}/${PN}/${PN}-debuginfo/setup.hint <<-_EOF +category: Debug +requires: +sdesc: "Debug info for ${PN}" +ldesc: "This package contains files necessary for debugging the +${PN} package with gdb." +_EOF + fi + fi + # e.g. split library package w/o PN in PKG_NAMES if [ ! -f ${distdir}/${PN}/setup.hint ] then diff --git a/lib/src_postinst.cygpart b/lib/src_postinst.cygpart index 0ba272a..84269e0 100644 --- a/lib/src_postinst.cygpart +++ b/lib/src_postinst.cygpart @@ -834,9 +834,11 @@ __prep_empty_dirs() { #**** __prepstrip() { + local dbg; local exe; local all_exes; - local strip; + local objcopy; + local objdump; if defined _CYGPORT_RESTRICT_strip_ then @@ -865,18 +867,21 @@ __prepstrip() { mv ${exe} ${exe%.exe} ;; esac continue - elif check_prog ${CTARGET}-strip && ${CTARGET}-size -f ${exe} &>/dev/null + elif check_prog ${CTARGET}-objcopy && ${CTARGET}-size -f ${exe} &>/dev/null then # for cross-compiled libs, cross-GCC target libs, # or non-cross packages built on non-Cygwin systems - strip="${CTARGET}-strip" - elif check_prog ${CHOST}-strip && ${CHOST}-size -f ${exe} &>/dev/null + objcopy="${CTARGET}-objcopy" + objdump="${CTARGET}-objdump" + elif check_prog ${CHOST}-objcopy && ${CHOST}-size -f ${exe} &>/dev/null then # for cross-compilers built on non-Cygwin systems - strip="${CHOST}-strip" + objcopy="${CHOST}-objcopy" + objdump="${CHOST}-objdump" elif size -f ${exe} &>/dev/null then - strip="strip" + objcopy="objcopy" + objdump="objdump" else continue fi @@ -912,8 +917,50 @@ __prepstrip() { echo " ${exe}"; chmod 0755 ${exe}; - ${strip} ${exe}; + + if defined _CYGPORT_RESTRICT_debuginfo_ + then + ${objcopy} --strip-all ${exe}; + else + dbg="/usr/lib/debug/${exe}.dbg"; + + dodir ${dbg%/*} + ${objcopy} --only-keep-debug ${exe} ${D}${dbg}; + ${objdump} -dl ${exe} | grep /usr/src/debug | sed -e 's/:.*$//g' > ${D}${dbg}.list + ${objcopy} --strip-all ${exe}; + ${objcopy} --add-gnu-debuglink=${D}${dbg} ${exe}; + fi + done +} + +__prepdebugsrc() { + local dbg; + local dbgdir="/usr/lib/debug"; + local dbgsrc; + local dbgsrcdir="/usr/src/debug/${PF}"; + local srcf; + + if defined _CYGPORT_RESTRICT_debuginfo_ || [ ! -d ${D}${dbgdir} ] + then + return; + fi + + echo "Preparing debuginfo source files:"; + + for dbgsrc in $(cat $(find ${D}${dbgdir} -name '*.dbg.list') | sort -u) + do + srcf=${dbgsrc#${dbgsrcdir}/} + if [ -f ${B}/${srcf} ] + then + install -D -m0644 ${B}/${srcf} ${D}${dbgsrc} + elif [ -f ${S}/${srcf} ] + then + install -D -m0644 ${S}/${srcf} ${D}${dbgsrc} +# else +# install -D -m0644 $(find ${B} -name ${srcf##*/}) ${D}${dbgsrc} + fi done + find ${D}${dbgdir} -name '*.dbg.list' -delete } #****P* Postinstall/Windows UAC @@ -1271,6 +1318,7 @@ __prep_libtool_modules() { # DESCRIPTION # List of automatic postinstall or packaging step(s) which should be skipped # for this package. Supported values are: +# * debuginfo: do not create a debuginfo subpackage # * diff: do not generate a .src.patch file of changes made in $S. # * postinst-doc: do not install standard documentation files. # * postinst-gconf: do not create postinstall commands for GConf schemas. @@ -1293,6 +1341,7 @@ __src_postinst() { __prepvargames; __prep_libtool_modules; __prepstrip; + __prepdebugsrc; __prepuac; __prep_empty_dirs; } @@ -1303,4 +1352,5 @@ readonly -f __prep_fonts_dir __prep_freedesktop_mime __prep_gconf_schemas \ __prep_mateconf_schemas __prep_texlive __prep_xsessions \ __prepdoc __prepemacs __prepetc __prepman __prepinfo \ __prepvargames __prep_empty_dirs \ - __prepstrip __prepuac __prep_symlinks __prep_libtool_modules __src_postinst + __prepstrip __prepdebugsrc __prepuac __prep_symlinks \ + __prep_libtool_modules __src_postinst