Mon Jun 29 12:01:39 2020 UTC ()
bootstrap: Set some default variables.

Saves having to duplicate them for every OS, and also removes some obsolete
settings, should be no functional change.


(jperkin)
diff -r1.281 -r1.282 pkgsrc/bootstrap/bootstrap

cvs diff -r1.281 -r1.282 pkgsrc/bootstrap/bootstrap (expand / switch to unified diff)

--- pkgsrc/bootstrap/bootstrap 2020/05/30 21:36:15 1.281
+++ pkgsrc/bootstrap/bootstrap 2020/06/29 12:01:38 1.282
@@ -1,16 +1,16 @@ @@ -1,16 +1,16 @@
1#! /bin/sh 1#! /bin/sh
2 2
3# $NetBSD: bootstrap,v 1.281 2020/05/30 21:36:15 jperkin Exp $ 3# $NetBSD: bootstrap,v 1.282 2020/06/29 12:01:38 jperkin Exp $
4# 4#
5# Copyright (c) 2001-2011 Alistair Crooks <agc@NetBSD.org> 5# Copyright (c) 2001-2011 Alistair Crooks <agc@NetBSD.org>
6# All rights reserved. 6# All rights reserved.
7# 7#
8# Redistribution and use in source and binary forms, with or without 8# Redistribution and use in source and binary forms, with or without
9# modification, are permitted provided that the following conditions 9# modification, are permitted provided that the following conditions
10# are met: 10# are met:
11# 1. Redistributions of source code must retain the above copyright 11# 1. Redistributions of source code must retain the above copyright
12# notice, this list of conditions and the following disclaimer. 12# notice, this list of conditions and the following disclaimer.
13# 2. Redistributions in binary form must reproduce the above copyright 13# 2. Redistributions in binary form must reproduce the above copyright
14# notice, this list of conditions and the following disclaimer in the 14# notice, this list of conditions and the following disclaimer in the
15# documentation and/or other materials provided with the distribution. 15# documentation and/or other materials provided with the distribution.
16# 16#
@@ -525,187 +525,154 @@ else @@ -525,187 +525,154 @@ else
525 [ -z "$pkgmandir" ] && pkgmandir=man 525 [ -z "$pkgmandir" ] && pkgmandir=man
526fi 526fi
527infodir=${prefix}/${pkginfodir} 527infodir=${prefix}/${pkginfodir}
528mandir=${prefix}/${pkgmandir} 528mandir=${prefix}/${pkgmandir}
529[ -z "$sysconfdir" ] && sysconfdir=${prefix}/etc 529[ -z "$sysconfdir" ] && sysconfdir=${prefix}/etc
530 530
531if [ "x$preserve_path" != "xyes" ]; then 531if [ "x$preserve_path" != "xyes" ]; then
532 PATH="$PATH:/sbin:/usr/sbin" 532 PATH="$PATH:/sbin:/usr/sbin"
533fi 533fi
534 534
535overpath="" 535overpath=""
536root_user=root 536root_user=root
537bmakexargs= 537bmakexargs=
 538need_awk=no
 539need_bsd_install=no
538need_extras=no 540need_extras=no
 541need_sed=no
 542need_xargs=no
 543set_opsys=no
539use_bsdinstall= 544use_bsdinstall=
540case "$opsys" in 545case "$opsys" in
541AIX) 546AIX)
542 root_group=system 547 root_group=system
543 need_bsd_install=yes 548 need_bsd_install=yes
544 need_awk=yes 549 need_awk=yes
545 need_sed=yes 550 need_sed=yes
546 need_ksh=yes 551 need_ksh=yes
547 need_fixed_strip=yes 552 need_fixed_strip=yes
548 set_opsys=no 
549 machine_arch=`get_machine_arch_aix` 553 machine_arch=`get_machine_arch_aix`
550 ;; 554 ;;
551Bitrig) 555Bitrig)
552 root_group=wheel 556 root_group=wheel
553 need_bsd_install=no 
554 need_awk=no 
555 need_sed=no 
556 set_opsys=no 
557 machine_arch=`arch -s` 557 machine_arch=`arch -s`
558 check_compiler=yes 558 check_compiler=yes
559 ;; 559 ;;
560CYGWIN_*) 560CYGWIN_*)
561 is_root () { 561 is_root () {
562 if id -nG | grep -q 'Administrators'; then 562 if id -nG | grep -q 'Administrators'; then
563 return 0 563 return 0
564 fi 564 fi
565 return 1 565 return 1
566 } 566 }
567 root_user=Administrators 567 root_user=Administrators
568 root_group=Administrators 568 root_group=Administrators
569 need_bsd_install=no 
570 opsys=`uname -o` 569 opsys=`uname -o`
571 need_awk=no 
572 need_sed=yes 570 need_sed=yes
573 need_xargs=no 
574 machine_arch=`uname -m` 571 machine_arch=`uname -m`
575 # only used for unprivileged builds. 572 # only used for unprivileged builds.
576 whoamiprog='id -u' 573 whoamiprog='id -u'
577 groupsprog='id -g' 574 groupsprog='id -g'
578 ;; 575 ;;
579 576
580Darwin) 577Darwin)
581 root_group=wheel 578 root_group=wheel
582 need_bsd_install=no 
583 need_awk=yes 579 need_awk=yes
584 need_sed=yes 580 need_sed=yes
585 set_opsys=no 
586 machine_arch=`get_machine_arch_darwin` 581 machine_arch=`get_machine_arch_darwin`
587 CC=${CC:-"cc -isystem /usr/include"}; export CC 582 CC=${CC:-"cc -isystem /usr/include"}; export CC
588 check_compiler=yes 583 check_compiler=yes
589 osrev=`uname -r` 584 osrev=`uname -r`
590 macosx_version=`echo $osrev | awk -F . '{ print "10."$1-4; }'` 585 macosx_version=`echo $osrev | awk -F . '{ print "10."$1-4; }'`
591 case "$macosx_version" in 586 case "$macosx_version" in
592 10.[7-9]) 587 10.[7-9])
593 packagemaker=/Applications/PackageMaker.app/Contents/MacOS/PackageMaker 588 packagemaker=/Applications/PackageMaker.app/Contents/MacOS/PackageMaker
594 ;; 589 ;;
595 10.[0-4]) 590 10.[0-4])
596 packagemaker=/Developer/Tools/packagemaker 591 packagemaker=/Developer/Tools/packagemaker
597 ;; 592 ;;
598 *) 593 *)
599 packagemaker=/Developer/usr/bin/packagemaker 594 packagemaker=/Developer/usr/bin/packagemaker
600 ;; 595 ;;
601 esac 596 esac
602 case "$macosx_version" in 597 case "$macosx_version" in
603 10.[0-7]) 598 10.[0-7])
604 need_awk=no 599 need_awk=no
605 need_sed=no 600 need_sed=no
606 ;; 601 ;;
607 esac 602 esac
608 unset osrev macosx_version 603 unset osrev macosx_version
609 ;; 604 ;;
610DragonFly) 605DragonFly)
611 root_group=wheel 606 root_group=wheel
612 need_bsd_install=no 
613 need_awk=no 
614 need_sed=no 
615 set_opsys=no 
616 check_prog tarprog tar 607 check_prog tarprog tar
617 machine_arch=`uname -p` 608 machine_arch=`uname -p`
618 ;; 609 ;;
619FreeBSD) 610FreeBSD)
620 root_group=wheel 611 root_group=wheel
621 need_bsd_install=no 
622 need_awk=no 
623 need_sed=no 
624 set_opsys=no 
625 machine_arch=`uname -p` 612 machine_arch=`uname -p`
626 check_compiler=yes 613 check_compiler=yes
627 ;; 614 ;;
628FreeMiNT) 615FreeMiNT)
629 root_group=root 616 root_group=root
630 need_bsd_install=no 
631 need_awk=no 
632 need_sed=no 
633 set_opsys=no 
634 machine_arch=m68k 617 machine_arch=m68k
635 ;; 618 ;;
636GNUkFreeBSD) 619GNUkFreeBSD)
637 root_group=root 620 root_group=root
638 need_bsd_install=no 
639 need_awk=yes 621 need_awk=yes
640 need_sed=no 
641 set_opsys=no 
642 machine_arch=`uname -m` 622 machine_arch=`uname -m`
643 ;; 623 ;;
644Haiku) 624Haiku)
645 root_user=`id -un` 625 root_user=`id -un`
646 root_group=root 626 root_group=root
647 need_bsd_install=no 
648 need_awk=no 
649 need_sed=no 
650 set_opsys=no 
651 case `uname -m` in 627 case `uname -m` in
652 BeMac) 628 BeMac)
653 machine_arch=powerpc 629 machine_arch=powerpc
654 ;; 630 ;;
655 BePC) 631 BePC)
656 machine_arch=i386 632 machine_arch=i386
657 ;; 633 ;;
658 *) 634 *)
659 machine_arch=`uname -p` 635 machine_arch=`uname -p`
660 ;; 636 ;;
661 esac 637 esac
662 ;; 638 ;;
663HPUX) 639HPUX)
664 root_group=sys 640 root_group=sys
665 need_bsd_install=yes 641 need_bsd_install=yes
666 need_awk=yes 642 need_awk=yes
667 need_sed=yes 643 need_sed=yes
668 set_opsys=no 
669 machine_arch=`uname -m | sed 's/^9000.*$/hppa/'` 644 machine_arch=`uname -m | sed 's/^9000.*$/hppa/'`
670 ;; 645 ;;
671Interix) 646Interix)
672 is_root () { 647 is_root () {
673 if id -G | grep -q 131616; then 648 if id -G | grep -q 131616; then
674 return 0 649 return 0
675 fi 650 fi
676 return 1 651 return 1
677 } 652 }
678 mkdir_p () { 653 mkdir_p () {
679 mkdir -p "$@" # allows umask to take effect 654 mkdir -p "$@" # allows umask to take effect
680 } 655 }
681 default_install_mode=0775 656 default_install_mode=0775
682 root_user=`id -un` 657 root_user=`id -un`
683 root_group=+Administrators 658 root_group=+Administrators
684 case `uname -r` in 659 case `uname -r` in
685 3.* | 5.*) 660 3.* | 5.*)
686 need_bsd_install=yes 661 need_bsd_install=yes
687 need_awk=yes 662 need_awk=yes
688 need_sed=yes 663 need_sed=yes
689 set_opsys=no 
690 need_xargs=yes 664 need_xargs=yes
691 ;; 665 ;;
692 *) 
693 need_bsd_install=no 
694 need_awk=no 
695 need_sed=no 
696 set_opsys=no 
697 need_xargs=no 
698 ;; 
699 esac 666 esac
700 # only used for unprivileged builds 667 # only used for unprivileged builds
701 groupsprog="id -gn" 668 groupsprog="id -gn"
702 # for bootstrap only; pkgsrc uses CPPFLAGS 669 # for bootstrap only; pkgsrc uses CPPFLAGS
703 CC="gcc -D_ALL_SOURCE"; export CC 670 CC="gcc -D_ALL_SOURCE"; export CC
704 ac_cv_header_poll_h=no; export ac_cv_header_poll_h 671 ac_cv_header_poll_h=no; export ac_cv_header_poll_h
705 ac_cv_func_poll=no; export ac_cv_func_poll 672 ac_cv_func_poll=no; export ac_cv_func_poll
706 ;; 673 ;;
707IRIX*) 674IRIX*)
708 if [ -d "/usr/freeware/bin" ]; then 675 if [ -d "/usr/freeware/bin" ]; then
709 overpath="/usr/freeware/bin:$overpath" 676 overpath="/usr/freeware/bin:$overpath"
710 fi 677 fi
711 if [ -d "/usr/bsd" ]; then 678 if [ -d "/usr/bsd" ]; then
@@ -725,182 +692,148 @@ IRIX*) @@ -725,182 +692,148 @@ IRIX*)
725 check_compiler=yes 692 check_compiler=yes
726 if [ `uname -r` -lt 6 ]; then 693 if [ `uname -r` -lt 6 ]; then
727# IRIX 5's mkdir bails out with an error when trying to create with the -p 694# IRIX 5's mkdir bails out with an error when trying to create with the -p
728# option an already existing directory 695# option an already existing directory
729 need_mkdir=yes 696 need_mkdir=yes
730 fi 697 fi
731 ;; 698 ;;
732Linux) 699Linux)
733 if [ -f /etc/ssdlinux_version ]; then 700 if [ -f /etc/ssdlinux_version ]; then
734 root_group=wheel 701 root_group=wheel
735 else 702 else
736 root_group=root 703 root_group=root
737 fi 704 fi
738 need_bsd_install=no 
739 # Debian/Ubuntu's awk is mawk, and mawk does not understand 705 # Debian/Ubuntu's awk is mawk, and mawk does not understand
740 # some regexp used in pkgsrc/mk. 706 # some regexp used in pkgsrc/mk.
741 if [ -f /etc/debian_version ]; then 707 if [ -f /etc/debian_version ]; then
742 need_awk=yes 708 need_awk=yes
743 # Arch uses gawk 5 that breaks some regexps. It doesn't provide pax 709 # Arch uses gawk 5 that breaks some regexps. It doesn't provide pax
744 # anymore. 710 # anymore.
745 elif [ -f /etc/arch-release ]; then 711 elif [ -f /etc/arch-release ]; then
746 need_awk=yes 712 need_awk=yes
747 need_pax=yes 713 need_pax=yes
748 elif grep -sq '^CHROMEOS_RELEASE_NAME' /etc/lsb-release; then 714 elif grep -sq '^CHROMEOS_RELEASE_NAME' /etc/lsb-release; then
749 need_awk=yes 715 need_awk=yes
750 need_sed=yes 716 need_sed=yes
751 else 
752 need_awk=no 
753 need_sed=no 
754 fi 717 fi
755 set_opsys=no 
756 machine_arch=`uname -m` 718 machine_arch=`uname -m`
757 # Override machine_arch where required. 719 # Override machine_arch where required.
758 case "$machine_arch" in 720 case "$machine_arch" in
759 i?86) machine_arch=i386 ;; 721 i?86) machine_arch=i386 ;;
760 ppc64le) machine_arch=powerpc64le ;; 722 ppc64le) machine_arch=powerpc64le ;;
761 esac 723 esac
762 ;; 724 ;;
763Minix) 725Minix)
764 root_group=wheel 726 root_group=wheel
765 need_bsd_install=no 
766 need_awk=no 
767 need_sed=no 
768 set_opsys=no 
769 machine_arch=`uname -p` 727 machine_arch=`uname -p`
770 check_compiler=yes 728 check_compiler=yes
771 ;;  729 ;;
772MirBSD) 730MirBSD)
773 root_group=wheel 731 root_group=wheel
774 need_pax=yes 732 need_pax=yes
775 need_mtree=no 
776 need_bsd_install=no 
777 need_awk=no 
778 need_sed=no 
779 set_opsys=no 
780 check_prog mtreeprog mtree 
781 machine_arch=`arch -s` 733 machine_arch=`arch -s`
782 # there is no /usr/bin/cc, so use mgcc if unset 734 # there is no /usr/bin/cc, so use mgcc if unset
783 test -n "$CC" || { CC=mgcc; export CC; } 735 test -n "$CC" || { CC=mgcc; export CC; }
784 # get some variables from the native make if unset 736 # get some variables from the native make if unset
785 for var in CFLAGS CPPFLAGS LDFLAGS; do 737 for var in CFLAGS CPPFLAGS LDFLAGS; do
786 # check if variable is already set 738 # check if variable is already set
787 eval _tmp=\"\$$var\" 739 eval _tmp=\"\$$var\"
788 [ "x$_tmp" != x ] && continue 740 [ "x$_tmp" != x ] && continue
789 # ask the native make (EXPERIMENTAL = don't add -Werror) 741 # ask the native make (EXPERIMENTAL = don't add -Werror)
790 # the -I${.CURDIR} dance is to prevent junk in CPPFLAGS 742 # the -I${.CURDIR} dance is to prevent junk in CPPFLAGS
791 _tmp=`printf '%s\nall:\n\t@%s %%s %s=${%s:M*:Q:Q}\n%s\n%s\n' \ 743 _tmp=`printf '%s\nall:\n\t@%s %%s %s=${%s:M*:Q:Q}\n%s\n%s\n' \
792 $var'+=-I${.CURDIR}' printf $var $var':S/-I${.CURDIR}//' \ 744 $var'+=-I${.CURDIR}' printf $var $var':S/-I${.CURDIR}//' \
793 EXPERIMENTAL=yes '.include <bsd.prog.mk>' | \ 745 EXPERIMENTAL=yes '.include <bsd.prog.mk>' | \
794 (unset MAKECONF; /usr/bin/make -f - all 2>/dev/null) | \ 746 (unset MAKECONF; /usr/bin/make -f - all 2>/dev/null) | \
795 sed 's/^x//'` 747 sed 's/^x//'`
796 eval $_tmp 748 eval $_tmp
797 eval export $var 749 eval export $var
798 done 750 done
799 ;; 751 ;;
800NetBSD) 752NetBSD)
801 root_group=wheel 753 root_group=wheel
802 need_bsd_install=no 
803 need_awk=no 
804 need_sed=no 
805 set_opsys=no 
806 machine_arch=`uname -p` 754 machine_arch=`uname -p`
807 ;; 755 ;;
808OpenBSD) 756OpenBSD)
809 root_group=wheel 757 root_group=wheel
810 need_bsd_install=no 
811 need_awk=no 
812 need_sed=no 
813 set_opsys=no 
814 machine_arch=`arch -s` 758 machine_arch=`arch -s`
815 CC=${CC:-cc}; export CC 759 CC=${CC:-cc}; export CC
816 check_compiler=yes 760 check_compiler=yes
817 ;; 761 ;;
818OSF1) 762OSF1)
819 root_group=system 763 root_group=system
820 need_bsd_install=yes 764 need_bsd_install=yes
821 need_awk=yes 765 need_awk=yes
822 need_sed=yes 766 need_sed=yes
823 need_ksh=yes 767 need_ksh=yes
824 set_opsys=no 
825 machine_arch=`uname -p` 768 machine_arch=`uname -p`
826 ;; 769 ;;
827QNX) 770QNX)
828 root_group=root 771 root_group=root
829 need_bsd_install=yes 772 need_bsd_install=yes
830 need_awk=yes 773 need_awk=yes
831 need_sed=yes 774 need_sed=yes
832 set_opsys=no 
833 groupsprog="id -gn" 775 groupsprog="id -gn"
834 whoamiprog="id -un" 776 whoamiprog="id -un"
835 machine_arch=`uname -p | sed -e 's/x86/i386/'` 777 machine_arch=`uname -p | sed -e 's/x86/i386/'`
836 ;; 778 ;;
837SCO_SV) 779SCO_SV)
838 root_group=root 780 root_group=root
839 need_awk=yes 781 need_awk=yes
840 need_bsd_install=yes 782 need_bsd_install=yes
841 need_sed=yes 783 need_sed=yes
842 set_opsys=no 
843 whoamiprog='id -u' 784 whoamiprog='id -u'
844 groupsprog='id -g' 785 groupsprog='id -g'
845 # /bin/sh under OpenServer 5.0.7/3.2 breaks bmake tests. 786 # /bin/sh under OpenServer 5.0.7/3.2 breaks bmake tests.
846 #bmakexargs="$bmakexargs --with-defshell=/bin/ksh" 787 #bmakexargs="$bmakexargs --with-defshell=/bin/ksh"
847 ;; 788 ;;
848SunOS) 789SunOS)
849 root_group=root 790 root_group=root
850 need_bsd_install=yes 791 need_bsd_install=yes
851 use_bsdinstall=yes 792 use_bsdinstall=yes
852 if [ -x "/usr/gnu/bin/awk" ]; then 793 if [ ! -x "/usr/gnu/bin/awk" ]; then
853 need_awk=no 
854 else 
855 need_awk=yes 794 need_awk=yes
856 fi 795 fi
857 if [ -x "/usr/gnu/bin/sed" ]; then 796 if [ ! -x "/usr/gnu/bin/sed" ]; then
858 need_sed=no 
859 else 
860 need_sed=yes 797 need_sed=yes
861 fi 798 fi
862 if [ -x "/usr/bin/bash" ]; then 799 if [ -x "/usr/bin/bash" ]; then
863 bootstrap_sh=${SH:-/usr/bin/bash} 800 bootstrap_sh=${SH:-/usr/bin/bash}
864 bootstrap_sh_set=set 801 bootstrap_sh_set=set
865 else 802 else
866 need_ksh=yes 803 need_ksh=yes
867 fi 804 fi
868 set_opsys=no 
869 idprog="/usr/xpg4/bin/id" 805 idprog="/usr/xpg4/bin/id"
870 groupsprog="${idprog} -gn" 806 groupsprog="${idprog} -gn"
871 whoamiprog="${idprog} -un" 807 whoamiprog="${idprog} -un"
872 machine_arch=`isainfo -k` 808 machine_arch=`isainfo -k`
873 check_compiler=yes 809 check_compiler=yes
874 check_ssp=yes 810 check_ssp=yes
875 ;; 811 ;;
876UnixWare) 812UnixWare)
877 root_group=sys 813 root_group=sys
878 need_bsd_install=no 
879 BSTRAP_ENV="INSTALL=/usr/ucb/install $BSTRAP_ENV" 814 BSTRAP_ENV="INSTALL=/usr/ucb/install $BSTRAP_ENV"
880 need_mkdir=yes 815 need_mkdir=yes
881 need_awk=yes 816 need_awk=yes
882 need_sed=yes 817 need_sed=yes
883 whoamiprog=/usr/ucb/whoami 818 whoamiprog=/usr/ucb/whoami
884 set_opsys=no 
885 CC="gcc -DUNIXWARE"; export CC 819 CC="gcc -DUNIXWARE"; export CC
886 ;; 820 ;;
887*) 821*)
888 echo "This platform ($opsys) is untried - good luck, and thanks for using pkgsrc" 822 echo "This platform ($opsys) is untried - good luck, and thanks for using pkgsrc"
889 root_group=wheel 823 root_group=wheel
890 need_bsd_install=yes 824 need_bsd_install=yes
891 need_awk=yes 825 need_awk=yes
892 need_sed=yes 826 need_sed=yes
893 set_opsys=no 
894 ;; 827 ;;
895esac 828esac
896 829
897# Fixup MACHINE_ARCH to use canonical pkgsrc variants, and support multiarch 830# Fixup MACHINE_ARCH to use canonical pkgsrc variants, and support multiarch
898# systems via --abi, setting a default $abi based on MACHINE_ARCH if not set. 831# systems via --abi, setting a default $abi based on MACHINE_ARCH if not set.
899# 832#
900case "$machine_arch/$abi" in 833case "$machine_arch/$abi" in
901# "amd64" translates to "x86_64", defaults to 64-bit 834# "amd64" translates to "x86_64", defaults to 64-bit
902amd64/32) abi=32 machine_arch=i386 ;; 835amd64/32) abi=32 machine_arch=i386 ;;
903amd64/*) abi=64 machine_arch=x86_64 ;; 836amd64/*) abi=64 machine_arch=x86_64 ;;
904# XXX: hppa untested 837# XXX: hppa untested
905hppa/64) abi=64 machine_arch=hppa64 ;; 838hppa/64) abi=64 machine_arch=hppa64 ;;
906hppa/*) abi=32 machine_arch=hppa ;; 839hppa/*) abi=32 machine_arch=hppa ;;