pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pkg/41130: cleanup/portability patch for bootstrap script



>Number:         41130
>Category:       pkg
>Synopsis:       cleanup/portability patch for bootstrap script
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Fri Apr 03 16:25:00 +0000 2009
>Originator:     Tim Larson
>Release:        n/a
>Organization:
>Environment:
n/a
>Description:
Alphabetize a big case statement for readability.

Minor additions to support A/UX.
>How-To-Repeat:

>Fix:
root@marcie 21# cvs diff bootstrap/bootstrap
Index: bootstrap/bootstrap
===================================================================
RCS file: /cvsroot/pkgsrc/bootstrap/bootstrap,v
retrieving revision 1.141
diff -u -p -r1.141 bootstrap
--- bootstrap/bootstrap 5 Feb 2009 18:53:03 -0000       1.141
+++ bootstrap/bootstrap 3 Apr 2009 16:13:32 -0000
@@ -36,7 +36,7 @@
 #set -x

 # the following environment variables are honored:
-# compiler/linker flags: CFLAGS, CPPFLAGS, LDFLAGS
+# compiler/linker flags: CFLAGS, CPPFLAGS, LDFLAGS, LIBS
 # tools: CP, GREP, ID, MKDIR, SH, TEST, TOUCH, XARGS


@@ -443,6 +443,26 @@ bmakexenv=
 bmakexargs=
 need_extras=no
 case "$opsys" in
+AIX)
+       root_group=system
+       need_bsd_install=yes
+       need_awk=yes
+       need_sed=yes
+       need_fixed_strip=yes
+       set_opsys=no
+       machine_arch=`get_machine_arch_aix`
+       ;;
+AUX)  # not customized much
+       echo "This platform ($opsys) is not well tested yet...good luck"
+       root_group=root
+       need_bsd_install=yes
+       need_awk=yes
+       need_sed=yes
+       need_mkdir=yes
+       set_opsys=no
+       CPPFLAGS="$CPPFLAGS -D_POSIX_SOURCE -I/opt/include"
+       LIBS="$LIBS -lposix"
+       ;;
 Darwin)
        root_group=wheel
        need_bsd_install=no
@@ -499,6 +519,31 @@ HPUX)
        set_opsys=no
        machine_arch=`uname -m | sed 's/^9000.*$/hppa/'`
        ;;
+Interix)
+       is_root () {
+               if id -G | grep -q 131616; then
+                       return 1
+               fi
+               return 0
+       }
+       mkdir_p () {
+               mkdir -p "$@" # allows umask to take effect
+       }
+       default_install_mode=0775
+       root_user=`id -u`
+       root_group=131616
+       need_bsd_install=yes
+       need_awk=yes
+       need_sed=yes
+       set_opsys=no
+       need_xargs=yes
+       # only used for unprivileged builds
+       groupsprog="id -gn"
+       # for bootstrap only; pkgsrc uses CPPFLAGS
+       CC="gcc -D_ALL_SOURCE"; export CC
+       ac_cv_header_poll_h=no; export ac_cv_header_poll_h
+       ac_cv_func_poll=no; export ac_cv_func_poll
+       ;;
 IRIX*)
        if [ -d "/usr/freeware/bin" ]; then
                overpath="/usr/freeware/bin:$overpath"
@@ -550,6 +595,23 @@ OpenBSD)
        set_opsys=no
        machine_arch=`uname -m`
        ;;
+OSF1)
+       root_group=system
+       need_bsd_install=yes
+       need_awk=yes
+       need_sed=yes
+       need_ksh=yes
+       set_opsys=no
+       ;;
+QNX)
+       root_group=root
+       need_bsd_install=yes
+       set_opsys=no
+       groupsprog="id -gn"
+       whoamiprog="id -un"
+       fetch_cmd="/usr/bin/ftp"
+       machine_arch=`uname -p | sed -e 's/x86/i386/'`
+       ;;
 SunOS)
        if [ -d "/usr/xpg4/bin" ]; then
                overpath="/usr/xpg4/bin:$overpath"
@@ -565,40 +627,6 @@ SunOS)
        machine_arch=`uname -p | sed -e 's/i86pc/i386/'`
        check_compiler=yes
        ;;
-AIX)
-       root_group=system
-       need_bsd_install=yes
-       need_awk=yes
-       need_sed=yes
-       need_fixed_strip=yes
-       set_opsys=no
-       machine_arch=`get_machine_arch_aix`
-       ;;
-Interix)
-       is_root () {
-               if id -G | grep -q 131616; then
-                       return 1
-               fi
-               return 0
-       }
-       mkdir_p () {
-               mkdir -p "$@" # allows umask to take effect
-       }
-       default_install_mode=0775
-       root_user=`id -u`
-       root_group=131616
-       need_bsd_install=yes
-       need_awk=yes
-       need_sed=yes
-       set_opsys=no
-       need_xargs=yes
-       # only used for unprivileged builds
-       groupsprog="id -gn"
-       # for bootstrap only; pkgsrc uses CPPFLAGS
-       CC="gcc -D_ALL_SOURCE"; export CC
-       ac_cv_header_poll_h=no; export ac_cv_header_poll_h
-       ac_cv_func_poll=no; export ac_cv_func_poll
-       ;;
 UnixWare)
        root_group=sys
        need_bsd_install=no
@@ -610,23 +638,6 @@ UnixWare)
        set_opsys=no
        CC="gcc -DUNIXWARE"; export CC
        ;;
-OSF1)
-       root_group=system
-       need_bsd_install=yes
-       need_awk=yes
-       need_sed=yes
-       need_ksh=yes
-       set_opsys=no
-       ;;
-QNX)
-       root_group=root
-       need_bsd_install=yes
-       set_opsys=no
-       groupsprog="id -gn"
-       whoamiprog="id -un"
-       fetch_cmd="/usr/bin/ftp"
-       machine_arch=`uname -p | sed -e 's/x86/i386/'`
-       ;;
 *)
        echo "This platform ($opsys) is untried - good luck, and thanks for 
using pkgsrc"
        root_group=wheel
@@ -696,7 +707,11 @@ check_prog lnprog ln
 check_prog lsprog ls
 check_prog rmdirprog rmdir
 check_prog sedprog sed
-check_prog shprog sh
+if [ ${opsys} = "AUX" ]; then
+       check_prog shprog ksh
+else
+       check_prog shprog sh
+fi
 check_prog whoamiprog whoami

 mkdir_p_early ${wrkdir}
@@ -731,6 +746,14 @@ fi

 mkdir_p_early ${wrkdir}/bin

+# /bin/sh in A/UX is really really bad - won't run this script
+# don't do this earlier, because A/UX mkdir will choke on the dir creation
+if [ ${opsys} = "AUX" -a ! -f ./AuxKsh ]; then
+       touch ./AuxKsh
+       echo_msg "restarting bootstrap under ksh"
+       exec /bin/ksh $0
+fi
+
 # build install-sh
 run_cmd "$sedprog -e 
's|@DEFAULT_INSTALL_MODE@|'${default_install_mode-0755}'|' 
$pkgsrcdir/sysutils/install-sh/files/install-sh.in > $wrkdir/bin/install-sh"
 run_cmd "$chmodprog +x $wrkdir/bin/install-sh"
@@ -788,7 +811,7 @@ VARBASE=$varbase; export VARBASE

 # set up an example mk.conf file
 TARGET_MKCONF=${wrkdir}/mk.conf.example
-echo_msg "Creating default mk.conf. in ${wrkdir}"
+echo_msg "Creating default mk.conf in ${wrkdir}"
 echo "# Example ${sysconfdir}/mk.conf file produced by bootstrap-pkgsrc" > 
${TARGET_MKCONF}
 echo "# `date`" >> ${TARGET_MKCONF}
 echo "" >> ${TARGET_MKCONF}
@@ -888,9 +911,12 @@ bootstrap_bmake
 bmake="$wrkdir/bin/bmake $make_quiet_flags"

 # build libnbcompat
+bootstrap_libnbcompat() {
 echo_msg "Building libnbcompat"
 copy_src $pkgsrcdir/pkgtools/libnbcompat/files libnbcompat
 run_cmd "(cd $wrkdir/libnbcompat; $shprog ./configure $configure_quiet_flags 
-C --prefix=$prefix --mandir=$mandir --sysconfdir=$sysconfdir 
--enable-bsd-getopt --enable-db && $bmake $make_quiet_flags)"
+}
+bootstrap_libnbcompat

 # bootstrap ksh if necessary
 case "$need_ksh" in
@@ -926,7 +952,7 @@ esac
 case "$need_sed" in
 yes)   echo_msg "Bootstrapping sed"
        copy_src $pkgsrcdir/textproc/nbsed/files sed
-       run_cmd "(cd $wrkdir/sed; env $BSTRAP_ENV CPPFLAGS='$CPPFLAGS 
-I../libnbcompat' LDFLAGS='$LDFLAGS -L../libnbcompat' LIBS='-lnbcompat' $shprog 
./configure $configure_quiet_flags -C --prefix=$prefix --mandir=$mandir 
--sysconfdir=$sysconfdir --program-transform-name='s,sed,nbsed,' && $bmake)"
+       run_cmd "(cd $wrkdir/sed; env $BSTRAP_ENV CPPFLAGS='$CPPFLAGS 
-I../libnbcompat' LDFLAGS='$LDFLAGS -L../libnbcompat' LIBS='$LIBS -lnbcompat' 
$shprog ./configure $configure_quiet_flags -C --prefix=$prefix --mandir=$mandir 
--sysconfdir=$sysconfdir --program-transform-name='s,sed,nbsed,' && $bmake)"
        run_cmd "$install_sh -c -o $user -g $group -m 755 $wrkdir/sed/sed 
$wrkdir/bin/sed"
        echo "TOOLS_PLATFORM.sed?=              $prefix/bin/nbsed" >> 
${TARGET_MKCONF}
        echo "TOOLS_PLATFORM.sed?=              $wrkdir/bin/sed" >> 
${BOOTSTRAP_MKCONF}
@@ -939,7 +965,7 @@ copy_src $pkgsrcdir/pkgtools/pkg_install
 run_cmd "(cd $wrkdir/pkg_install; env $BSTRAP_ENV \
 CPPFLAGS='$CPPFLAGS -I../libnbcompat -I../../libnbcompat' \
 LDFLAGS='$LDFLAGS -L../libnbcompat -L../../libnbcompat' \
-LIBS='-lnbcompat' $shprog ./configure $configure_quiet_flags -C \
+LIBS='$LIBS -lnbcompat' $shprog ./configure $configure_quiet_flags -C \
 --enable-bootstrap --prefix=$prefix --sysconfdir=$sysconfdir \
 --with-pkgdbdir=$pkgdbdir --mandir=$mandir $pkg_install_args && $bmake)"
 run_cmd "$install_sh -c -o $user -g $group -m 755 
$wrkdir/pkg_install/admin/pkg_admin $wrkdir/sbin/pkg_admin"
@@ -1085,6 +1111,10 @@ echo ""
 [ ! -z "${binary_gzip_kit}" ] && mkbinarykit_tgz
 [ ! -z "${binary_macpkg}" ] && mkbinarykit_macpkg

+if [ ${opsys} = "AUX" -a -f ./AuxKsh ]; then
+       rm ./AuxKsh
+fi
+
 echo_msg "bootstrap started: $build_start"
 echo_msg "bootstrap ended:   `date`"



Home | Main Index | Thread Index | Old Index