| @@ -1,16 +1,16 @@ | | | @@ -1,16 +1,16 @@ |
1 | #! /bin/sh | | 1 | #! /bin/sh |
2 | | | 2 | |
3 | # $NetBSD: bootstrap,v 1.289 2020/07/21 15:53:10 sjmulder Exp $ | | 3 | # $NetBSD: bootstrap,v 1.290 2020/08/14 07:24:16 schmonz 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 | # |
| @@ -49,72 +49,49 @@ export NO_PKGTOOLS_REQD_CHECK | | | @@ -49,72 +49,49 @@ export NO_PKGTOOLS_REQD_CHECK |
49 | unprivileged=no | | 49 | unprivileged=no |
50 | | | 50 | |
51 | preserve_path=no | | 51 | preserve_path=no |
52 | | | 52 | |
53 | # where the building takes place | | 53 | # where the building takes place |
54 | bootstrapdir=`dirname "$0"` | | 54 | bootstrapdir=`dirname "$0"` |
55 | bootstrapdir=`cd "${bootstrapdir}" && pwd` | | 55 | bootstrapdir=`cd "${bootstrapdir}" && pwd` |
56 | pkgsrcdir=`dirname "${bootstrapdir}"` | | 56 | pkgsrcdir=`dirname "${bootstrapdir}"` |
57 | wrkdir="`pwd`/work" | | 57 | wrkdir="`pwd`/work" |
58 | | | 58 | |
59 | usage="Usage: $0 "' | | 59 | usage="Usage: $0 "' |
60 | [ --abi [32|64] ] | | 60 | [ --abi [32|64] ] |
61 | [ --binary-kit <tarball> ] | | 61 | [ --binary-kit <tarball> ] |
62 | [ --binary-macpkg <pkg> ] | | | |
63 | [ --compiler <compiler> ] | | 62 | [ --compiler <compiler> ] |
64 | [ --cwrappers <auto|yes|no> ] | | 63 | [ --cwrappers <auto|yes|no> ] |
65 | [ --full ] | | 64 | [ --full ] |
66 | [ --gzip-binary-kit <tarball> ] | | 65 | [ --gzip-binary-kit <tarball> ] |
67 | [ --help ] | | 66 | [ --help ] |
68 | [ --make-jobs <num> ] | | 67 | [ --make-jobs <num> ] |
69 | [ --mk-fragment <mk.conf> ] | | 68 | [ --mk-fragment <mk.conf> ] |
70 | [ --pkgdbdir <pkgdbdir> ] | | 69 | [ --pkgdbdir <pkgdbdir> ] |
71 | [ --pkginfodir <pkginfodir> ] | | 70 | [ --pkginfodir <pkginfodir> ] |
72 | [ --pkgmandir <pkgmandir> ] | | 71 | [ --pkgmandir <pkgmandir> ] |
73 | [ --prefer-pkgsrc <list|yes|no> ] | | 72 | [ --prefer-pkgsrc <list|yes|no> ] |
74 | [ --prefix <prefix> ] | | 73 | [ --prefix <prefix> ] |
75 | [ --preserve-path ] | | 74 | [ --preserve-path ] |
76 | [ --quiet ] | | 75 | [ --quiet ] |
77 | [ --sysconfdir <sysconfdir> ] | | 76 | [ --sysconfdir <sysconfdir> ] |
78 | [ --unprivileged | --ignore-user-check ] | | 77 | [ --unprivileged | --ignore-user-check ] |
79 | [ --varbase <varbase> ] | | 78 | [ --varbase <varbase> ] |
80 | [ --workdir <workdir> ] | | 79 | [ --workdir <workdir> ] |
81 | ' | | 80 | ' |
82 | | | 81 | |
83 | # strip / for BSD/OS, strip - for HP-UX | | 82 | # strip / for BSD/OS, strip - for HP-UX |
84 | opsys=`uname -s | tr -d /-` | | 83 | opsys=`uname -s | tr -d /-` |
85 | | | 84 | |
86 | mkbinarykit_macpkg() | | | |
87 | { | | | |
88 | local macdestdir | | | |
89 | macdestdir=${wrkdir}/macpkg-destdir | | | |
90 | rm -rf ${macdestdir} || die "cleanup destdir" | | | |
91 | | | | |
92 | mkdir -p ${macdestdir}${prefix} || die "mkdir destprefix" | | | |
93 | rmdir ${macdestdir}${prefix} || die "rmdir destprefix" | | | |
94 | cp -Rp ${prefix} ${macdestdir}${prefix} || die "copy prefix" | | | |
95 | | | | |
96 | if [ ! -d ${macdestdir}${pkgdbdir} ]; then | | | |
97 | mkdir -p ${macdestdir}${pkgdbdir} || die "mkdir destdbdir" | | | |
98 | rmdir ${macdestdir}${pkgdbdir} || die "rmdir destdbdir" | | | |
99 | cp -Rp ${pkgdbdir} ${macdestdir}${pkgdbdir} || die "copy dbdir" | | | |
100 | fi | | | |
101 | | | | |
102 | ${sedprog} -e "s|%WRKDIR%|${wrkdir}|g" \ | | | |
103 | -e "s|%TARGETDIR%|${targetdir}|g" -e "s|%DATE%|${date}|g" \ | | | |
104 | < macpkg.pmproj.in > ${wrkdir}/macpkg.pmproj | | | |
105 | ${packagemaker} -build -proj ${wrkdir}/macpkg.pmproj -p "${binary_macpkg}" | | | |
106 | } | | | |
107 | | | | |
108 | mkbinarykit_tar() | | 85 | mkbinarykit_tar() |
109 | { | | 86 | { |
110 | # in case tar was built by bootstrap | | 87 | # in case tar was built by bootstrap |
111 | PATH="$prefix/bin:$PATH"; export PATH | | 88 | PATH="$prefix/bin:$PATH"; export PATH |
112 | cd / && tar -hcf "${binary_kit}" .$prefix .$pkgdbdir .$etc_mk_conf | | 89 | cd / && tar -hcf "${binary_kit}" .$prefix .$pkgdbdir .$etc_mk_conf |
113 | } | | 90 | } |
114 | | | 91 | |
115 | mkbinarykit_tgz() | | 92 | mkbinarykit_tgz() |
116 | { | | 93 | { |
117 | # in case tar was built by bootstrap | | 94 | # in case tar was built by bootstrap |
118 | PATH="$prefix/bin:$PATH"; export PATH | | 95 | PATH="$prefix/bin:$PATH"; export PATH |
119 | cd / && tar -hcf - .$prefix .$pkgdbdir .$etc_mk_conf | gzip > "${binary_gzip_kit}" | | 96 | cd / && tar -hcf - .$prefix .$pkgdbdir .$etc_mk_conf | gzip > "${binary_gzip_kit}" |
120 | } | | 97 | } |
| @@ -474,30 +451,26 @@ while [ $# -gt 0 ]; do | | | @@ -474,30 +451,26 @@ while [ $# -gt 0 ]; do |
474 | --preserve-path) preserve_path=yes ;; | | 451 | --preserve-path) preserve_path=yes ;; |
475 | --mk-fragment=*) | | 452 | --mk-fragment=*) |
476 | mk_fragment=`get_optarg "$1"` ;; | | 453 | mk_fragment=`get_optarg "$1"` ;; |
477 | --mk-fragment) | | 454 | --mk-fragment) |
478 | mk_fragment="$2"; shift ;; | | 455 | mk_fragment="$2"; shift ;; |
479 | --binary-kit=*) | | 456 | --binary-kit=*) |
480 | binary_kit=`get_optarg "$1"` ;; | | 457 | binary_kit=`get_optarg "$1"` ;; |
481 | --binary-kit) | | 458 | --binary-kit) |
482 | binary_kit="$2"; shift ;; | | 459 | binary_kit="$2"; shift ;; |
483 | --gzip-binary-kit=*) | | 460 | --gzip-binary-kit=*) |
484 | binary_gzip_kit=`get_optarg "$1"` ;; | | 461 | binary_gzip_kit=`get_optarg "$1"` ;; |
485 | --gzip-binary-kit) | | 462 | --gzip-binary-kit) |
486 | binary_gzip_kit="$2"; shift ;; | | 463 | binary_gzip_kit="$2"; shift ;; |
487 | --binary-macpkg=*) | | | |
488 | binary_macpkg=`get_optarg "$1"` ;; | | | |
489 | --binary-macpkg) | | | |
490 | binary_macpkg="$2"; shift ;; | | | |
491 | --make-jobs=*) make_jobs=`get_optarg "$1"` ;; | | 464 | --make-jobs=*) make_jobs=`get_optarg "$1"` ;; |
492 | --make-jobs) make_jobs="$2"; shift ;; | | 465 | --make-jobs) make_jobs="$2"; shift ;; |
493 | --full) full=yes ;; | | 466 | --full) full=yes ;; |
494 | --quiet) quiet=yes ;; | | 467 | --quiet) quiet=yes ;; |
495 | --help) echo "$usage"; exit ;; | | 468 | --help) echo "$usage"; exit ;; |
496 | -h) echo "$usage"; exit ;; | | 469 | -h) echo "$usage"; exit ;; |
497 | -*) echo "${0##*/}: unknown option \"$1\"" 1>&2 | | 470 | -*) echo "${0##*/}: unknown option \"$1\"" 1>&2 |
498 | echo "$usage" 1>&2; exit 1 ;; | | 471 | echo "$usage" 1>&2; exit 1 ;; |
499 | esac | | 472 | esac |
500 | shift | | 473 | shift |
501 | done | | 474 | done |
502 | | | 475 | |
503 | checkarg_sane_absolute_path "$pkgdbdir" "--pkgdbdir" | | 476 | checkarg_sane_absolute_path "$pkgdbdir" "--pkgdbdir" |
| @@ -1405,27 +1378,26 @@ build_package "pkgtools/pkg_install" | | | @@ -1405,27 +1378,26 @@ build_package "pkgtools/pkg_install" |
1405 | | | 1378 | |
1406 | etc_mk_conf="$sysconfdir/mk.conf" | | 1379 | etc_mk_conf="$sysconfdir/mk.conf" |
1407 | | | 1380 | |
1408 | # Install the example mk.conf so that it is used, but only if it doesn't | | 1381 | # Install the example mk.conf so that it is used, but only if it doesn't |
1409 | # exist yet. This can happen with non-default sysconfdir settings. | | 1382 | # exist yet. This can happen with non-default sysconfdir settings. |
1410 | mkdir_p "$sysconfdir" | | 1383 | mkdir_p "$sysconfdir" |
1411 | if [ ! -f "$etc_mk_conf" ]; then | | 1384 | if [ ! -f "$etc_mk_conf" ]; then |
1412 | cp "$TARGET_MKCONF" "$etc_mk_conf" | | 1385 | cp "$TARGET_MKCONF" "$etc_mk_conf" |
1413 | TARGET_MKCONF="$etc_mk_conf" | | 1386 | TARGET_MKCONF="$etc_mk_conf" |
1414 | fi | | 1387 | fi |
1415 | | | 1388 | |
1416 | [ -n "${binary_kit}" ] && mkbinarykit_tar | | 1389 | [ -n "${binary_kit}" ] && mkbinarykit_tar |
1417 | [ -n "${binary_gzip_kit}" ] && mkbinarykit_tgz | | 1390 | [ -n "${binary_gzip_kit}" ] && mkbinarykit_tgz |
1418 | [ -n "${binary_macpkg}" ] && mkbinarykit_macpkg | | | |
1419 | | | 1391 | |
1420 | hline="===========================================================================" | | 1392 | hline="===========================================================================" |
1421 | echo "" | | 1393 | echo "" |
1422 | echo "$hline" | | 1394 | echo "$hline" |
1423 | echo "" | | 1395 | echo "" |
1424 | echo "Please remember to add $prefix/bin to your PATH environment variable" | | 1396 | echo "Please remember to add $prefix/bin to your PATH environment variable" |
1425 | echo "and $mandir to your MANPATH environment variable, if necessary." | | 1397 | echo "and $mandir to your MANPATH environment variable, if necessary." |
1426 | echo "" | | 1398 | echo "" |
1427 | echo "An example mk.conf file with the settings you provided to \"bootstrap\"" | | 1399 | echo "An example mk.conf file with the settings you provided to \"bootstrap\"" |
1428 | echo "has been created for you. It can be found in:" | | 1400 | echo "has been created for you. It can be found in:" |
1429 | echo "" | | 1401 | echo "" |
1430 | echo " ${TARGET_MKCONF}" | | 1402 | echo " ${TARGET_MKCONF}" |
1431 | echo "" | | 1403 | echo "" |