From db787e07e99db33de0d6399d3bb54c92d1b5e303 Mon Sep 17 00:00:00 2001 From: Stefan Fiedler Date: Fri, 2 Nov 2007 13:28:52 +0000 Subject: [PATCH] Stefan Fiedler: scripts/Build-Pkg: always create ROCK dir below $root; this way $builddir can always be accessed as a subdir of $root re-add lib to $flistroot; this fixes the linux26 file list in 64-bit and multilib builds scripts/functions and scripts/Build-Pkg: fix paths passed to configure and make: use run-time paths (e.g. --prefix=/usr) for configure and don't set any paths in $makeopt; use DESTDIR= instead of prefix= as makeinstopt. Some packages hard-code paths passed to configure into their files, so these paths must not contain $root. E.g. cross-built ncurses does not work without this patch. scripts/functions: add "--with-gnu-ld" to $confopt [2007102819342784600] (https://www.rocklinux.net/submaster) git-svn-id: http://www.rocklinux.org/svn/rock-linux/trunk@8781 c5f82cb5-29bc-0310-9cd0-bff59a50e3bc --- scripts/Build-Pkg | 95 +++++++++++++++++++++++++------------------- scripts/config.cache | 2 + scripts/functions | 21 +++++----- 3 files changed, 67 insertions(+), 51 deletions(-) diff --git a/scripts/Build-Pkg b/scripts/Build-Pkg index c212145dc..62528fa11 100755 --- a/scripts/Build-Pkg +++ b/scripts/Build-Pkg @@ -143,7 +143,7 @@ export ROCK_CHECK_SYSTEM_OK=1 . ./scripts/functions . ./scripts/parse-config -if [ -z "$root" -a $stagelevel -le 1 ] || \ +if [ -z "$root" -a $stagelevel -le 2 ] || \ [ -z "$root" -a $chroot -eq 1 ] || \ [ "$root" = auto ]; then root="build/$ROCKCFG_ID" @@ -193,6 +193,35 @@ export ROCK_XPKG=$xpkg # Set permissions and ownership of $buildir; $base/build might have different ones. mkdir -p "$builddir"; chmod 700 "$builddir" ; chown 0:0 "$builddir" +pushd "$xroot/" >/dev/null || exit 1 + +realconf=$(cd $base/config; pwd -P) +realdown=$(cd $base/download; pwd -P) +realbase=$(dirname $(cd $base/scripts; pwd -P)) + +if [ ! -e ROCK/loop/scripts ]; then + mkdir -p ROCK/{loop,config,download} + mount --bind $realbase $PWD/ROCK/loop + mount --bind $realconf $PWD/ROCK/config + mount --bind $realdown $PWD/ROCK/download +fi + +for x in Documentation architecture misc package scripts target; do + if [ ! -e ROCK/$x ]; then ln -s "loop/$x" "ROCK/$x"; fi +done + +if [ ! -e "ROCK/build/$ROCKCFG_ID" ]; then + mkdir -p "ROCK/build" + ln -snf ../.. "ROCK/build/$ROCKCFG_ID" +fi + +# If build is a symlink to somewhere else (NFS share for clusterbuild +# usually) we do _not_ want to extract our stuff there. +# Network latency! +ln -sf loop/src.$xpkg.$id ROCK/src.$xpkg.$id + +popd >/dev/null + if [ "$chroot" = 1 ] ; then cd "$xroot" || exit 1 @@ -275,17 +304,6 @@ if [ "$chroot" = 1 ] ; then rm -f ${xroot#/}; ln -s / ${xroot#/} fi - realconf=$(cd $base/config; pwd -P) - realdown=$(cd $base/download; pwd -P) - realbase=$(dirname $(cd $base/scripts; pwd -P)) - - if [ ! -e ROCK/loop/scripts ]; then - mkdir -p ROCK/{loop,config,download} - mount --bind $realbase $PWD/ROCK/loop - mount --bind $realconf $PWD/ROCK/config - mount --bind $realdown $PWD/ROCK/download - fi - if [ ! -f proc/mounts ]; then mount -t proc proc $PWD/proc fi @@ -295,20 +313,6 @@ if [ "$chroot" = 1 ] ; then mount --rbind /dev $PWD/dev fi - for x in Documentation architecture misc package scripts target; do - if [ ! -e ROCK/$x ]; then ln -s "loop/$x" "ROCK/$x"; fi - done - - if [ ! -e "ROCK/build/$ROCKCFG_ID" ]; then - mkdir -p "ROCK/build" - ln -snf ../.. "ROCK/build/$ROCKCFG_ID" - fi - - # If build is a symlink to somewhere else (NFS share for clusterbuild - # usually) we do _not_ want to extract our stuff there. - # Network latency! - ln -s loop/src.$xpkg.$id ROCK/src.$xpkg.$id - cat > "$builddir/chroot.sh" <<- EOT #!/bin/bash export ROCK_THIS_IS_CHROOT=1; cd /ROCK @@ -511,7 +515,12 @@ fi # ---- Setting Build Variables # -dummydir="$builddir/rootdummy" +if [ -z "$root" ] ; then + dummydir="$builddir/rootdummy" +else + dummydir="${root}/ROCK/${builddir#$base/}/rootdummy" +fi + mkdir -p "$dummydir" if [[ "$xpkg" = *-32bit ]] ; then @@ -529,7 +538,7 @@ else multilib="lib64" fi -flistroot="bin boot etc $multilib sbin usr var opt" +flistroot="bin boot etc lib $multilib sbin usr var opt" flistrfilter="ldconfig\..*: .*|.*: /var/adm/.*" flistdel="var/adm/.*|var/tmp/.*|var/lock/.*|var/run/.*|etc/ld.so.cache|usr/tmp/.*|.*\\.old" @@ -555,15 +564,8 @@ if [ $stagelevel -le 2 ] ; then var_append makeopt ' ' 'RANLIB="$RANLIB" NM="$NM"' fi -var_append makeinstopt ' ' "$makeopt prefix=\$instroot/\$prefix install" -var_append makeopt ' ' 'prefix=/$prefix' - -if [ $stagelevel -le 2 ] ; then - for x in bindir sbindir datadir includedir \ - infodir mandir sysconfdir localstatedir ; do - var_append makeopt ' ' "$x=\${$x#\$instroot}" - done -fi +makeinstopt="$makeopt install" +[ "$root" ] && var_append makeinstopt ' ' 'DESTDIR=$root' if [ $stagelevel -ge 3 ] ; then flistdel="$flistdel|`echo $base | sed s,^/,,`/.*" @@ -891,7 +893,17 @@ exec 202>&1 # cat > "$builddir/debug_x.sh" <<- EOT #!/bin/bash - export PROMPT_COMMAND='. debug.buildenv; cd .; unset PROMPT_COMMAND' + # export PROMPT_COMMAND='. debug.buildenv; cd .; unset PROMPT_COMMAND' + cd "$root" + if [ ! -e $PWD/ROCK/loop/scripts ]; then + mount --bind $realbase $PWD/ROCK/loop + mount --bind $realconf $PWD/ROCK/config + mount --bind $realdown $PWD/ROCK/download + fi + if [ ! -e $PWD/ROCK/src.$xpkg.$id ]; then + ln -s loop/src.$xpkg.$id $PWD/ROCK/src.$xpkg.$id + fi + cd "$builddir" ; exec env -i bash --init-file debug.buildenv 200>> build.pid EOT # @@ -957,13 +969,14 @@ exec 202>&1 then xbase="$( cd $xroot/ 2> /dev/null ; pwd -P )" + egrepexp="[ ]($base|$xbase|$builddir|/tmp|/usr/lib/(conftest|cf)[0-9]*|/usr/tmp|/var/tmp|/var/backups|/proc|/dev)(/|$)" if cat $builddir/fl_wrapper.wlog | sed 's,//*,/,g' | \ - egrep -qv "[ ]($base|$xbase|$builddir|/tmp|/usr/tmp|/var/tmp|/var/backups|/proc|/dev)(/|$)" + egrep -qv "$egrepexp" then x="Created file outside basedir: " cat $builddir/fl_wrapper.wlog | sed 's,//*,/,g' | \ - egrep -v "[ ]($base|$xbase|$builddir|/tmp|/usr/tmp|/var/tmp|/proc|/dev)(/|$)" | \ - cut -f2- | sort -u | sed "s,^,$x," + egrep -v "$egrepexp" | cut -f2- | \ + sort -u | sed "s,^,$x," echo "base #1: $base" echo "base #2: $xbase" abort diff --git a/scripts/config.cache b/scripts/config.cache index 41e6ac126..58e1179ea 100644 --- a/scripts/config.cache +++ b/scripts/config.cache @@ -86,3 +86,5 @@ ac_cv_sizeof_uint64_t=8 libc_cv_forced_unwind=yes libc_cv_c_cleanup=yes +# mine +compat_cv_func_makedev_three_args=no diff --git a/scripts/functions b/scripts/functions index d8ed092fc..30649c9e1 100644 --- a/scripts/functions +++ b/scripts/functions @@ -179,7 +179,7 @@ column_clean_tab() { # Re-run it in the package .conf file if you modify $prefix # set_confopt() { - confopt="--prefix=$instroot/$prefix" + confopt="--prefix=${instroot#$root}/$prefix" bindir="$instroot/$prefix/bin" sbindir="$instroot/$prefix/sbin" @@ -214,19 +214,19 @@ set_confopt() { libdir="$root/$prefix/$multilib" - var_append confopt ' ' '--bindir=$bindir' - var_append confopt ' ' '--sbindir=$sbindir' + var_append confopt ' ' '--bindir=${bindir#$root}' + var_append confopt ' ' '--sbindir=${sbindir#$root}' - var_append confopt ' ' '--datadir=$datadir' - var_append confopt ' ' '--includedir=$includedir' + var_append confopt ' ' '--datadir=${datadir#$root}' + var_append confopt ' ' '--includedir=${includedir#$root}' - var_append confopt ' ' '--infodir=$infodir' - var_append confopt ' ' '--mandir=$mandir' + var_append confopt ' ' '--infodir=${infodir#$root}' + var_append confopt ' ' '--mandir=${mandir#$root}' - var_append confopt ' ' '--sysconfdir=$sysconfdir' - var_append confopt ' ' '--localstatedir=$localstatedir' + var_append confopt ' ' '--sysconfdir=${sysconfdir#$root}' + var_append confopt ' ' '--localstatedir=${localstatedir#$root}' - var_append confopt ' ' '--libdir=$libdir' + var_append confopt ' ' '--libdir=${libdir#$root}' if [ "$ROCKCFG_CONFIGURE_OPTS" ] ; then var_append confopt ' ' "$ROCKCFG_CONFIGURE_OPTS" @@ -240,6 +240,7 @@ set_confopt() { confopt="${confopt//--enable-nls/} --disable-nls" fi + var_append confopt ' ' '--with-gnu-ld' var_append confopt ' ' '$extraconfopt' if [ "$stagelevel" -eq 0 ]; then