From 28a5a070c1e4a123877805595b7d5feeb22d2f29 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Wed, 22 Oct 2008 01:54:48 +0200 Subject: [PATCH] Change autoconf pkgs to configure it with /usr or /. This depends if a package uses $base_package, by default not set, means the package will be installed into masterdir/usr, if set will be installed into masterdir directly. While here fixup binutils, gcc and glibc! I'm approaching to the point on where I'll be able to chroot into masterdir and having working pkgs installed. --HG-- extra : convert_revision : be3c3e0d7368e7a1e1ef1c9add932aeeab82688d --- templates/binutils.tmpl | 2 + templates/gcc.tmpl | 7 +- templates/glibc-runstuff-after-install.sh | 5 ++ templates/glibc-runstuff-before-install.sh | 3 + templates/glibc.tmpl | 11 ++- xbps.sh | 90 ++++++++++++---------- 6 files changed, 70 insertions(+), 48 deletions(-) create mode 100644 templates/glibc-runstuff-after-install.sh create mode 100644 templates/glibc-runstuff-before-install.sh diff --git a/templates/binutils.tmpl b/templates/binutils.tmpl index 4d542a2e651..485692c7e2f 100644 --- a/templates/binutils.tmpl +++ b/templates/binutils.tmpl @@ -4,6 +4,8 @@ version=2.18 distfiles="http://ftp.gnu.org/gnu/binutils/$pkgname-$version@.tar.bz2" build_style=gnu_configure configure_args="--disable-werror --enable-shared --disable-multilib" +make_install_target="tooldir=$XBPS_DESTDIR/$pkgname-$version + install prefix=$XBPS_DESTDIR/$pkgname-$version" short_desc="GNU binary utilities" maintainer="Juan RP " checksum=487a33a452f0edcf1f8bb8fc23dff5c7a82edec3f3f8b65632b6c945e961ee9b diff --git a/templates/gcc.tmpl b/templates/gcc.tmpl index d28c6cea014..80bbb9493e5 100644 --- a/templates/gcc.tmpl +++ b/templates/gcc.tmpl @@ -4,10 +4,11 @@ version=4.3.2 distfiles=" http://ftp.gnu.org/pub/gnu/gcc/$pkgname-$version/$pkgname-$version@.tar.bz2" build_style=gnu_configure -configure_args="--enable-clocale=gnu --disable-libstdcxx-pch +configure_args="--enable-clocale=gnu --disable-bootstrap --enable-threads=posix --enable-__cxa_atexit --disable-multilib - --enable-languages=c,c++,fortran,objc,obj-c++ - --with-mpfr=$XBPS_MASTERDIR --with-gmp=$XBPS_MASTERDIR" + --enable-languages=c,c++,objc,obj-c++ + --with-local-prefix=$XBPS_DESTDIR/$pkgname-$version + --with-mpfr=$XBPS_MASTERDIR/usr --with-gmp=$XBPS_MASTERDIR/usr" short_desc="The GNU C Compiler suite" maintainer="Juan RP " checksum=bfbf487731ad5dca37efe480a837417de071bd67e685d5c1df6a290707575165 diff --git a/templates/glibc-runstuff-after-install.sh b/templates/glibc-runstuff-after-install.sh new file mode 100644 index 00000000000..2dbf59a2004 --- /dev/null +++ b/templates/glibc-runstuff-after-install.sh @@ -0,0 +1,5 @@ +# +# Rebuild dynamic linker's cache after building glibc. +# +$XBPS_DESTDIR/$pkgname-$version/sbin/ldconfig -C $XBPS_SYSCONFDIR/ld.so.cache +$XBPS_DESTDIR/$pkgname-$version/sbin/ldconfig diff --git a/templates/glibc-runstuff-before-install.sh b/templates/glibc-runstuff-before-install.sh new file mode 100644 index 00000000000..af48a019c0a --- /dev/null +++ b/templates/glibc-runstuff-before-install.sh @@ -0,0 +1,3 @@ +# Create $XBPS_SYSCONFDIR/ld.conf +# +$touch_cmd $XBPS_SYSCONFDIR/ld.so.conf diff --git a/templates/glibc.tmpl b/templates/glibc.tmpl index 7aabb74669e..bd66254c788 100644 --- a/templates/glibc.tmpl +++ b/templates/glibc.tmpl @@ -4,14 +4,12 @@ version=2.8 wrksrc="libc" distfiles="ftp://ftp.archlinux.org/other/glibc/$pkgname-2.8_20080828@.tar.bz2" build_style=gnu_configure -unset LD_LIBRARY_PATH -disable_ldflags=yes -configure_script="$env_cmd CC=$XBPS_MASTERDIR/bin/gcc - CXX=$XBPS_MASTERDIR/bin/g++ CPP=$XBPS_MASTERDIR/bin/cpp - LD=$XBPS_MASTERDIR/bin/ld AS=$XBPS_MASTERDIR/bin/as ../configure" +configure_script="../configure" configure_args="--with-tls -disable-profile --with-__thread --enable-kernel=2.6.16 --enable-add-ons --without-gd --enable-bind-now - --without-cvs --without-selinux" + --without-cvs --without-selinux --prefix=/usr" +make_install_target="install_root=$XBPS_DESTDIR/$pkgname-$version install + localedata/install-locales" short_desc="The GNU C library" maintainer="Juan RP " checksum=f5756668f201e093cae0404e59dcf8c43ccc07757fd0a7455298ed89126c366a @@ -22,4 +20,5 @@ long_desc=" as C++ and Objective C; the runtime facilities of other programming languages use the C library to access the underlying operating system." +base_package=yes build_depends="gcc-4.3.2" diff --git a/xbps.sh b/xbps.sh index 46548f61237..f024222b59d 100755 --- a/xbps.sh +++ b/xbps.sh @@ -269,7 +269,7 @@ reset_tmpl_vars() run_stuff_before_install_cmd run_stuff_after_install_cmd \ make_install_target postinstall_helpers version \ ignore_files tar_override_cmd xml_entries sgml_entries \ - make_install_prefix build_depends disable_ldflags \ + build_depends \ XBPS_EXTRACT_DONE XBPS_CONFIGURE_DONE \ XBPS_BUILD_DONE XBPS_INSTALL_DONE" @@ -332,7 +332,9 @@ prepare_tmpl() XBPS_BUILD_DONE="$wrksrc/.xbps_build_done" XBPS_INSTALL_DONE="$wrksrc/.xbps_install_done" - export PATH="$XBPS_MASTERDIR/bin:$XBPS_MASTERDIR/sbin:/bin:/sbin:/usr/bin:/usr/sbin" + export PATH="$XBPS_MASTERDIR/bin:$XBPS_MASTERDIR/sbin" + export PATH="$PATH:$XBPS_MASTERDIR/usr/bin:$XBPS_MASTERDIR/usr/sbin" + export PATH="$PATH:/bin:/sbin:/usr/bin:/usr/sbin" } # @@ -582,42 +584,38 @@ fixup_tmpl_libtool() # we use the master directory while relinking, all will be fine # once the package is stowned. # - if [ -f $wrksrc/ltmain.sh ]; then + if [ -f $wrksrc/ltmain.sh -a -f $wrksrc/libtool ]; then $rm_cmd -f $wrksrc/libtool - $ln_cmd -s $XBPS_MASTERDIR/bin/libtool $wrksrc/libtool + $ln_cmd -s $XBPS_MASTERDIR/usr/bin/libtool $wrksrc/libtool fi for f in $($find_cmd $wrksrc -type f -name libtool); do if [ -f $f ]; then $rm_cmd -f $f - $ln_cmd -s $XBPS_MASTERDIR/bin/libtool $f + $ln_cmd -s $XBPS_MASTERDIR/usr/bin/libtool $f fi done } set_build_vars() { - if [ -z "$disable_ldflags" ]; then - LDFLAGS="-L$XBPS_MASTERDIR/lib -Wl,-R$XBPS_MASTERDIR/lib $LDFLAGS" - LDFLAGS="-L$XBPS_DESTDIR/$pkgname-$version/lib $LDFLAGS" - fi - + SAVE_LDLIBPATH=$LD_LIBRARY_PATH + LD_LIBRARY_PATH="$XBPS_MASTERDIR/usr/lib" + LDFLAGS="-L$XBPS_MASTERDIR/usr/lib" CFLAGS="$CFLAGS $XBPS_CFLAGS" CXXFLAGS="$CXXFLAGS $XBPS_CXXFLAGS" - CPPFLAGS="-I$XBPS_MASTERDIR/include $CPPFLAGS" - PKG_CONFIG="$XBPS_MASTERDIR/bin/pkg-config" + CPPFLAGS="-I$XBPS_MASTERDIR/usr/include $CPPFLAGS" + PKG_CONFIG="$XBPS_MASTERDIR/usr/bin/pkg-config" - if [ -z "$disable_ldflags" ]; then - export LDFLAGS="$LDFLAGS" - fi - - export CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" + export LD_LIBRARY_PATH="$LD_LIBRARY_PATH" + export LDFLAGS="$LDFLAGS" CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" export CPPFLAGS="$CPPFLAGS" PKG_CONFIG="$PKG_CONFIG" } unset_build_vars() { - unset LDFLAGS CFLAGS CXXFLAGS CPPFLAGS PKG_CONFIG + unset LDFLAGS CFLAGS CXXFLAGS CPPFLAGS PKG_CONFIG LD_LIBRARY_PATH + export LD_LIBRARY_PATH=$SAVE_LDLIBPATH } # @@ -709,20 +707,23 @@ configure_src_phase() [ -z "$configure_script" ] && configure_script="./configure" + local _prefix= + if [ -z "$base_package" ]; then + _prefix=/usr + else + _prefix=/ + fi + # # Packages using GNU autoconf # if [ "$build_style" = "gnu_configure" ]; then cd $wrksrc || exit 1 - # - # Pass consistent arguments to not have unexpected - # surprises later. - # - ${configure_script} \ - --prefix="$XBPS_MASTERDIR" \ - --mandir="$XBPS_DESTDIR/$pkgname-$version/man" \ - --infodir="$XBPS_DESTDIR/$pkgname-$version/share/info" \ - --sysconfdir="$XBPS_SYSCONFDIR" \ + ${configure_script} \ + --prefix=${_prefix} \ + --infodir=$XBPS_DESTDIR/$pkgname-$version/share/info \ + --mandir=$XBPS_DESTDIR/$pkgname-$version/share/man \ + --sysconfdir="$XBPS_SYSCONFDIR" \ ${configure_args} # @@ -852,7 +853,10 @@ install_src_phase() [ -z $pkg ] && [ -z $pkgname ] && return 1 - [ -z "$make_install_target" ] && make_install_target=install + if [ -z "$make_install_target" ]; then + make_install_target="install prefix=$XBPS_DESTDIR/$pkgname-$version" + fi + [ -z "$make_cmd" ] && make_cmd=/usr/bin/make # @@ -869,14 +873,10 @@ install_src_phase() echo "=> Running install phase for: $pkgname-$version." - [ -z "$make_install_prefix" ] && \ - make_install_prefix="prefix=$XBPS_DESTDIR/$pkgname-$version" - # # Install package via make. # - ${make_cmd} ${make_install_target} ${make_install_args} \ - ${make_install_prefix} + ${make_cmd} ${make_install_target} ${make_install_args} if [ "$?" -ne 0 ]; then echo "*** ERROR installing $pkgname-$version ***" exit 1 @@ -1400,10 +1400,15 @@ stow_pkg() xstow_ignore_files="$xstow_ignore_files $ignore_files" fi - $XBPS_XSTOW_CMD -ignore "${xstow_ignore_files}" ${xstow_args} \ - -pd-targets $XBPS_MASTERDIR \ - -dir $XBPS_DESTDIR -target $XBPS_MASTERDIR \ - $XBPS_DESTDIR/$pkg + if [ -z "$base_package" ]; then + local pkg_masterdir=$XBPS_MASTERDIR/usr + [ ! -d $pkg_masterdir ] && $mkdir_cmd -p $pkg_masterdir + else + local pkg_masterdir=$XBPS_MASTERDIR + fi + + $XBPS_XSTOW_CMD -ignore "${xstow_ignore_files}" ${xstow_args} \ + -dir $XBPS_DESTDIR -target $pkg_masterdir $XBPS_DESTDIR/$pkg if [ "$?" -ne 0 ]; then echo "*** ERROR: couldn't create symlinks for $pkg ***" exit 1 @@ -1461,8 +1466,15 @@ unstow_pkg() xstow_ignore_files="$xstow_ignore_files $ignore_files" fi - $XBPS_XSTOW_CMD -dir $XBPS_DESTDIR -target $XBPS_MASTERDIR \ - -D -i-file-in-dir share/info/dir -ignore \ + if [ -z "$base_package" ]; then + local pkg_masterdir=$XBPS_MASTERDIR/usr + [ ! -d $pkg_masterdir ] && $mkdir_cmd -p $pkg_masterdir + else + local pkg_masterdir=$XBPS_MASTERDIR + fi + + $XBPS_XSTOW_CMD -dir $XBPS_DESTDIR -target $pkg_masterdir \ + -D -i-file-in-dir share/info/dir -ignore \ "${xstow_ignore_files}" $XBPS_DESTDIR/$pkgname-$version if [ $? -ne 0 ]; then exit 1