| @@ -1,1188 +1,1194 @@ | | | @@ -1,1188 +1,1194 @@ |
1 | #! /bin/sh | | 1 | #! /bin/sh |
2 | | | 2 | |
3 | # $NetBSD: bootstrap,v 1.191 2013/03/11 22:48:23 tcort Exp $ | | 3 | # $NetBSD: bootstrap,v 1.192 2013/05/11 23:42:44 ryoon 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 | # |
17 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | | 17 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | | 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
19 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | | 19 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
20 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | | 20 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
21 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | | 21 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
22 | # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | | 22 | # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | | 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | | 24 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | | 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
26 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | | 26 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | # | | 27 | # |
28 | #set -x | | 28 | #set -x |
29 | | | 29 | |
30 | # the following environment variables are honored: | | 30 | # the following environment variables are honored: |
31 | # compiler/linker flags: CFLAGS, CPPFLAGS, LDFLAGS, LIBS | | 31 | # compiler/linker flags: CFLAGS, CPPFLAGS, LDFLAGS, LIBS |
32 | # tools: CP, GREP, ID, MKDIR, SH, TEST, TOUCH, XARGS | | 32 | # tools: CP, GREP, ID, MKDIR, SH, TEST, TOUCH, XARGS |
33 | | | 33 | |
34 | | | 34 | |
35 | BOOTSTRAP_VERSION=20060721 | | 35 | BOOTSTRAP_VERSION=20060721 |
36 | | | 36 | |
37 | # Don't let the bootstrap program get confused by a pre-existing mk.conf | | 37 | # Don't let the bootstrap program get confused by a pre-existing mk.conf |
38 | # file. | | 38 | # file. |
39 | MAKECONF=/dev/null | | 39 | MAKECONF=/dev/null |
40 | export MAKECONF | | 40 | export MAKECONF |
41 | | | 41 | |
42 | # No vulnerability checks since there might be an incompatible checker installed | | 42 | # No vulnerability checks since there might be an incompatible checker installed |
43 | NO_PKGTOOLS_REQD_CHECK=yes | | 43 | NO_PKGTOOLS_REQD_CHECK=yes |
44 | export NO_PKGTOOLS_REQD_CHECK | | 44 | export NO_PKGTOOLS_REQD_CHECK |
45 | | | 45 | |
46 | unprivileged=no | | 46 | unprivileged=no |
47 | | | 47 | |
48 | preserve_path=no | | 48 | preserve_path=no |
49 | | | 49 | |
50 | # where the building takes place | | 50 | # where the building takes place |
51 | bootstrapdir=`dirname "$0"` | | 51 | bootstrapdir=`dirname "$0"` |
52 | bootstrapdir=`cd "${bootstrapdir}" && pwd` | | 52 | bootstrapdir=`cd "${bootstrapdir}" && pwd` |
53 | pkgsrcdir=`dirname "${bootstrapdir}"` | | 53 | pkgsrcdir=`dirname "${bootstrapdir}"` |
54 | wrkdir="`pwd`/work" | | 54 | wrkdir="`pwd`/work" |
55 | | | 55 | |
56 | usage="Usage: $0 "' | | 56 | usage="Usage: $0 "' |
57 | [ --abi [32|64] ] | | 57 | [ --abi [32|64] ] |
58 | [ --binary-kit <tarball> ] | | 58 | [ --binary-kit <tarball> ] |
59 | [ --binary-macpkg <pkg> ] | | 59 | [ --binary-macpkg <pkg> ] |
60 | [ --compiler <compiler> ] | | 60 | [ --compiler <compiler> ] |
61 | [ --full ] | | 61 | [ --full ] |
62 | [ --gzip-binary-kit <tarball> ] | | 62 | [ --gzip-binary-kit <tarball> ] |
63 | [ --help ] | | 63 | [ --help ] |
64 | [ --mk-fragment <mk.conf> ] | | 64 | [ --mk-fragment <mk.conf> ] |
65 | [ --pkgdbdir <pkgdbdir> ] | | 65 | [ --pkgdbdir <pkgdbdir> ] |
66 | [ --pkgmandir <pkgmandir> ] | | 66 | [ --pkgmandir <pkgmandir> ] |
67 | [ --prefer-pkgsrc <list|yes|no> ] | | 67 | [ --prefer-pkgsrc <list|yes|no> ] |
68 | [ --prefix <prefix> ] | | 68 | [ --prefix <prefix> ] |
69 | [ --preserve-path ] | | 69 | [ --preserve-path ] |
70 | [ --quiet ] | | 70 | [ --quiet ] |
71 | [ --sysconfdir <sysconfdir> ] | | 71 | [ --sysconfdir <sysconfdir> ] |
72 | [ --unprivileged | --ignore-user-check ] | | 72 | [ --unprivileged | --ignore-user-check ] |
73 | [ --varbase <varbase> ] | | 73 | [ --varbase <varbase> ] |
74 | [ --workdir <workdir> ] | | 74 | [ --workdir <workdir> ] |
75 | ' | | 75 | ' |
76 | | | 76 | |
77 | # this replicates some of the logic in bsd.prefs.mk. until | | 77 | # this replicates some of the logic in bsd.prefs.mk. until |
78 | # bootstrap-pkgsrc is merged into pkgsrc, we need to determine the | | 78 | # bootstrap-pkgsrc is merged into pkgsrc, we need to determine the |
79 | # right value for OPSYS and MACHINE_ARCH. | | 79 | # right value for OPSYS and MACHINE_ARCH. |
80 | | | 80 | |
81 | # strip / for BSD/OS, strip - for HP-UX | | 81 | # strip / for BSD/OS, strip - for HP-UX |
82 | opsys=`uname -s | tr -d /-` | | 82 | opsys=`uname -s | tr -d /-` |
83 | | | 83 | |
84 | mkbinarykit_macpkg() | | 84 | mkbinarykit_macpkg() |
85 | { | | 85 | { |
86 | local macdestdir | | 86 | local macdestdir |
87 | macdestdir=${wrkdir}/macpkg-destdir | | 87 | macdestdir=${wrkdir}/macpkg-destdir |
88 | rm -rf ${macdestdir} || die "cleanup destdir" | | 88 | rm -rf ${macdestdir} || die "cleanup destdir" |
89 | | | 89 | |
90 | mkdir -p ${macdestdir}${prefix} || die "mkdir destprefix" | | 90 | mkdir -p ${macdestdir}${prefix} || die "mkdir destprefix" |
91 | rmdir ${macdestdir}${prefix} || die "rmdir destprefix" | | 91 | rmdir ${macdestdir}${prefix} || die "rmdir destprefix" |
92 | cp -Rp ${prefix} ${macdestdir}${prefix} || die "copy prefix" | | 92 | cp -Rp ${prefix} ${macdestdir}${prefix} || die "copy prefix" |
93 | | | 93 | |
94 | if [ ! -d ${macdestdir}${pkgdbdir} ]; then | | 94 | if [ ! -d ${macdestdir}${pkgdbdir} ]; then |
95 | mkdir -p ${macdestdir}${pkgdbdir} || die "mkdir destdbdir" | | 95 | mkdir -p ${macdestdir}${pkgdbdir} || die "mkdir destdbdir" |
96 | rmdir ${macdestdir}${pkgdbdir} || die "rmdir destdbdir" | | 96 | rmdir ${macdestdir}${pkgdbdir} || die "rmdir destdbdir" |
97 | cp -Rp ${pkgdbdir} ${macdestdir}${pkgdbdir} || die "copy dbdir" | | 97 | cp -Rp ${pkgdbdir} ${macdestdir}${pkgdbdir} || die "copy dbdir" |
98 | fi | | 98 | fi |
99 | | | 99 | |
100 | ${sedprog} -e "s|%WRKDIR%|${wrkdir}|g" \ | | 100 | ${sedprog} -e "s|%WRKDIR%|${wrkdir}|g" \ |
101 | -e "s|%TARGETDIR%|${targetdir}|g" -e "s|%DATE%|${date}|g" \ | | 101 | -e "s|%TARGETDIR%|${targetdir}|g" -e "s|%DATE%|${date}|g" \ |
102 | < macpkg.pmproj.in > ${wrkdir}/macpkg.pmproj | | 102 | < macpkg.pmproj.in > ${wrkdir}/macpkg.pmproj |
103 | ${packagemaker} -build -proj ${wrkdir}/macpkg.pmproj -p "${binary_macpkg}" | | 103 | ${packagemaker} -build -proj ${wrkdir}/macpkg.pmproj -p "${binary_macpkg}" |
104 | } | | 104 | } |
105 | | | 105 | |
106 | mkbinarykit_tar() | | 106 | mkbinarykit_tar() |
107 | { | | 107 | { |
108 | # in case tar was built by bootstrap | | 108 | # in case tar was built by bootstrap |
109 | PATH="$prefix/bin:$PATH"; export PATH | | 109 | PATH="$prefix/bin:$PATH"; export PATH |
110 | cd / && tar -hcf "${binary_kit}" .$prefix .$pkgdbdir .$etc_mk_conf | | 110 | cd / && tar -hcf "${binary_kit}" .$prefix .$pkgdbdir .$etc_mk_conf |
111 | } | | 111 | } |
112 | | | 112 | |
113 | mkbinarykit_tgz() | | 113 | mkbinarykit_tgz() |
114 | { | | 114 | { |
115 | # in case tar was built by bootstrap | | 115 | # in case tar was built by bootstrap |
116 | PATH="$prefix/bin:$PATH"; export PATH | | 116 | PATH="$prefix/bin:$PATH"; export PATH |
117 | cd / && tar -hcf - .$prefix .$pkgdbdir .$etc_mk_conf | gzip > "${binary_gzip_kit}" | | 117 | cd / && tar -hcf - .$prefix .$pkgdbdir .$etc_mk_conf | gzip > "${binary_gzip_kit}" |
118 | } | | 118 | } |
119 | | | 119 | |
120 | die() | | 120 | die() |
121 | { | | 121 | { |
122 | echo >&2 "$@" | | 122 | echo >&2 "$@" |
123 | exit 1 | | 123 | exit 1 |
124 | } | | 124 | } |
125 | | | 125 | |
126 | echo_msg() | | 126 | echo_msg() |
127 | { | | 127 | { |
128 | echo "===> $@" | | 128 | echo "===> $@" |
129 | } | | 129 | } |
130 | | | 130 | |
131 | # see if we're using gcc. If so, set $compiler_is_gnu to '1'. | | 131 | # see if we're using gcc. If so, set $compiler_is_gnu to '1'. |
132 | get_compiler() | | 132 | get_compiler() |
133 | { | | 133 | { |
134 | testcc="${CC}" | | 134 | testcc="${CC}" |
135 | # normally, we'd just use 'cc', but certain configure tools look | | 135 | # normally, we'd just use 'cc', but certain configure tools look |
136 | # for gcc specifically, so we have to see if that comes first | | 136 | # for gcc specifically, so we have to see if that comes first |
137 | if [ -z "${testcc}" ]; then | | 137 | if [ -z "${testcc}" ]; then |
138 | save_IFS="${IFS}" | | 138 | save_IFS="${IFS}" |
139 | IFS=':' | | 139 | IFS=':' |
140 | for dir in ${PATH}; do | | 140 | for dir in ${PATH}; do |
141 | test -z "$dir" && dir=. | | 141 | test -z "$dir" && dir=. |
142 | if [ -x "$dir/gcc" ]; then | | 142 | if [ -x "$dir/gcc" ]; then |
143 | testcc="$dir/gcc" | | 143 | testcc="$dir/gcc" |
144 | break | | 144 | break |
145 | fi | | 145 | fi |
146 | done | | 146 | done |
147 | IFS="${save_IFS}" | | 147 | IFS="${save_IFS}" |
148 | fi | | 148 | fi |
149 | | | 149 | |
150 | cat >${wrkdir}/$$.c <<EOF | | 150 | cat >${wrkdir}/$$.c <<EOF |
151 | #ifdef __GNUC__ | | 151 | #ifdef __GNUC__ |
152 | indeed | | 152 | indeed |
153 | #endif | | 153 | #endif |
154 | EOF | | 154 | EOF |
155 | compiler_is_gnu=`${testcc:-cc} -E ${wrkdir}/$$.c 2>/dev/null | grep -c indeed` | | 155 | compiler_is_gnu=`${testcc:-cc} -E ${wrkdir}/$$.c 2>/dev/null | grep -c indeed` |
156 | rm -f ${wrkdir}/$$.c | | 156 | rm -f ${wrkdir}/$$.c |
157 | | | 157 | |
158 | } | | 158 | } |
159 | get_abi() | | 159 | get_abi() |
160 | { | | 160 | { |
161 | abi_opsys=$@ | | 161 | abi_opsys=$@ |
162 | | | 162 | |
163 | if [ -n "$abi" ]; then | | 163 | if [ -n "$abi" ]; then |
164 | die "ERROR: $abi_opsys has special ABI handling, --abi not supported (yet)." | | 164 | die "ERROR: $abi_opsys has special ABI handling, --abi not supported (yet)." |
165 | fi | | 165 | fi |
166 | | | 166 | |
167 | case "$abi_opsys" in | | 167 | case "$abi_opsys" in |
168 | IRIX) | | 168 | IRIX) |
169 | if [ `uname -r` -ge 6 ]; then | | 169 | if [ `uname -r` -ge 6 ]; then |
170 | abi=`sed -e 's/.*\(abi=\)\([on]*[36][24]\).*/\2/' /etc/compiler.defaults` | | 170 | abi=`sed -e 's/.*\(abi=\)\([on]*[36][24]\).*/\2/' /etc/compiler.defaults` |
171 | isa=`sed -e 's/.*\(isa=mips\)\([1234]\).*/\2/' /etc/compiler.defaults` | | 171 | isa=`sed -e 's/.*\(isa=mips\)\([1234]\).*/\2/' /etc/compiler.defaults` |
172 | case "$abi" in | | 172 | case "$abi" in |
173 | o32) | | 173 | o32) |
174 | imakeopts="-DBuildO32 -DSgiISAo32=$isa" | | 174 | imakeopts="-DBuildO32 -DSgiISAo32=$isa" |
175 | abi="" | | 175 | abi="" |
176 | ;; | | 176 | ;; |
177 | n32) imakeopts="-DBuildN32 -DSgiISA32=$isa" | | 177 | n32) imakeopts="-DBuildN32 -DSgiISA32=$isa" |
178 | abi="32" | | 178 | abi="32" |
179 | ;; | | 179 | ;; |
180 | 64 | n64) | | 180 | 64 | n64) |
181 | imakeopts="-DBuild64bit -DSgiISA64=$isa" | | 181 | imakeopts="-DBuild64bit -DSgiISA64=$isa" |
182 | abi="64" | | 182 | abi="64" |
183 | ;; | | 183 | ;; |
184 | esac | | 184 | esac |
185 | else # IRIX before 6 | | 185 | else # IRIX before 6 |
186 | abi=32 | | 186 | abi=32 |
187 | fi | | 187 | fi |
188 | ;; | | 188 | ;; |
189 | esac | | 189 | esac |
190 | } | | 190 | } |
191 | | | 191 | |
192 | get_machine_arch_aix() | | 192 | get_machine_arch_aix() |
193 | { | | 193 | { |
194 | _cpuid=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` | | 194 | _cpuid=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` |
195 | if /usr/sbin/lsattr -El $_cpuid | grep ' POWER' >/dev/null 2>&1; then | | 195 | if /usr/sbin/lsattr -El $_cpuid | grep ' POWER' >/dev/null 2>&1; then |
196 | echo rs6000 | | 196 | echo rs6000 |
197 | else | | 197 | else |
198 | echo powerpc | | 198 | echo powerpc |
199 | fi | | 199 | fi |
200 | } | | 200 | } |
201 | | | 201 | |
202 | check_prog() | | 202 | check_prog() |
203 | { | | 203 | { |
204 | _var="$1"; _name="$2" | | 204 | _var="$1"; _name="$2" |
205 | | | 205 | |
206 | eval _tmp=\"\$$_var\" | | 206 | eval _tmp=\"\$$_var\" |
207 | if [ "x$_tmp" != "x" ]; then | | 207 | if [ "x$_tmp" != "x" ]; then |
208 | # Variable is already set (by the user, for example) | | 208 | # Variable is already set (by the user, for example) |
209 | return 0 | | 209 | return 0 |
210 | fi | | 210 | fi |
211 | | | 211 | |
212 | for _d in `echo $PATH | tr ':' ' '`; do | | 212 | for _d in `echo $PATH | tr ':' ' '`; do |
213 | if [ -f "$_d/$_name" ] && [ -x "$_d/$_name" ]; then | | 213 | if [ -f "$_d/$_name" ] && [ -x "$_d/$_name" ]; then |
214 | # Program found | | 214 | # Program found |
215 | eval $_var=\""$_d/$_name"\" | | 215 | eval $_var=\""$_d/$_name"\" |
216 | return 1 | | 216 | return 1 |
217 | fi | | 217 | fi |
218 | done | | 218 | done |
219 | | | 219 | |
220 | die "$_name not found in path." | | 220 | die "$_name not found in path." |
221 | } | | 221 | } |
222 | | | 222 | |
223 | opsys_finish() | | 223 | opsys_finish() |
224 | { | | 224 | { |
225 | case "$opsys" in | | 225 | case "$opsys" in |
226 | IRIX) | | 226 | IRIX) |
227 | if [ -n "$imakeopts" ]; then | | 227 | if [ -n "$imakeopts" ]; then |
228 | echo "IMAKEOPTS+= $imakeopts" >> ${TARGET_MKCONF} | | 228 | echo "IMAKEOPTS+= $imakeopts" >> ${TARGET_MKCONF} |
229 | fi | | 229 | fi |
230 | if [ `uname -r` -lt 6 ]; then | | 230 | if [ `uname -r` -lt 6 ]; then |
231 | echo_msg "Installing fake ldd script" | | 231 | echo_msg "Installing fake ldd script" |
232 | run_cmd "$install_sh -c -o $user -g $group -m 755 $pkgsrcdir/pkgtools/bootstrap-extras/files/fakeldd $prefix/sbin" | | 232 | run_cmd "$install_sh -c -o $user -g $group -m 755 $pkgsrcdir/pkgtools/bootstrap-extras/files/fakeldd $prefix/sbin" |
233 | need_extras=yes | | 233 | need_extras=yes |
234 | echo "LDD= $prefix/sbin/fakeldd" >> ${TARGET_MKCONF} | | 234 | echo "LDD= $prefix/sbin/fakeldd" >> ${TARGET_MKCONF} |
235 | fi | | 235 | fi |
236 | ;; | | 236 | ;; |
237 | Haiku) | | 237 | Haiku) |
238 | need_extras=yes | | 238 | need_extras=yes |
239 | echo "LDD= $prefix/sbin/fakeldd" >> ${TARGET_MKCONF} | | 239 | echo "LDD= $prefix/sbin/fakeldd" >> ${TARGET_MKCONF} |
240 | ;; | | 240 | ;; |
241 | esac | | 241 | esac |
242 | } | | 242 | } |
243 | | | 243 | |
244 | is_root() | | 244 | is_root() |
245 | { | | 245 | { |
246 | if [ `uname -s` = "IRIX" ]; then | | 246 | if [ `uname -s` = "IRIX" ]; then |
247 | if [ `uname -r` -lt 6 -a -z "$ID" ]; then | | 247 | if [ `uname -r` -lt 6 -a -z "$ID" ]; then |
248 | # older version of IRIX have an id command with limited features | | 248 | # older version of IRIX have an id command with limited features |
249 | if [ "`$idprog`" != "uid=0(root) gid=0(sys)" ]; then | | 249 | if [ "`$idprog`" != "uid=0(root) gid=0(sys)" ]; then |
250 | return 1 | | 250 | return 1 |
251 | fi | | 251 | fi |
252 | return 0 | | 252 | return 0 |
253 | fi | | 253 | fi |
254 | fi | | 254 | fi |
255 | if [ `$idprog -u` != 0 ]; then | | 255 | if [ `$idprog -u` != 0 ]; then |
256 | return 1 | | 256 | return 1 |
257 | fi | | 257 | fi |
258 | return 0 | | 258 | return 0 |
259 | } | | 259 | } |
260 | | | 260 | |
261 | # run a command, abort if it fails | | 261 | # run a command, abort if it fails |
262 | run_cmd() | | 262 | run_cmd() |
263 | { | | 263 | { |
264 | echo_msg "running: $@" | | 264 | echo_msg "running: $@" |
265 | eval "$@" | | 265 | eval "$@" |
266 | ret=$? | | 266 | ret=$? |
267 | if [ $ret -ne 0 ]; then | | 267 | if [ $ret -ne 0 ]; then |
268 | echo_msg "exited with status $ret" | | 268 | echo_msg "exited with status $ret" |
269 | die "aborted." | | 269 | die "aborted." |
270 | fi | | 270 | fi |
271 | } | | 271 | } |
272 | | | 272 | |
273 | # Some versions of mkdir (notably SunOS) bail out too easily, so use the | | 273 | # Some versions of mkdir (notably SunOS) bail out too easily, so use the |
274 | # install-sh wrapper instead. | | 274 | # install-sh wrapper instead. |
275 | mkdir_p() | | 275 | mkdir_p() |
276 | { | | 276 | { |
277 | for dir in $@; do | | 277 | for dir in $@; do |
278 | run_cmd "$install_sh -d -o $user -g $group $dir" | | 278 | run_cmd "$install_sh -d -o $user -g $group $dir" |
279 | done | | 279 | done |
280 | } | | 280 | } |
281 | | | 281 | |
282 | mkdir_p_early() | | 282 | mkdir_p_early() |
283 | { | | 283 | { |
284 | [ -d "$1" ] && return 0 | | 284 | [ -d "$1" ] && return 0 |
285 | mkdir -p "$1" 2> /dev/null && return 0 | | 285 | mkdir -p "$1" 2> /dev/null && return 0 |
286 | parent=`dirname "$1"` | | 286 | parent=`dirname "$1"` |
287 | mkdir_p_early "$parent" | | 287 | mkdir_p_early "$parent" |
288 | if [ ! -d "$1" ] && mkdir "$1"; then | | 288 | if [ ! -d "$1" ] && mkdir "$1"; then |
289 | echo_msg "mkdir $1 exited with status $?" | | 289 | echo_msg "mkdir $1 exited with status $?" |
290 | die "aborted." | | 290 | die "aborted." |
291 | fi | | 291 | fi |
292 | return 0 | | 292 | return 0 |
293 | } | | 293 | } |
294 | | | 294 | |
295 | copy_src() | | 295 | copy_src() |
296 | { | | 296 | { |
297 | _src="$1"; _dst="$2" | | 297 | _src="$1"; _dst="$2" |
298 | if [ ! -d $wrkdir/$_dst ]; then | | 298 | if [ ! -d $wrkdir/$_dst ]; then |
299 | mkdir_p $wrkdir/$_dst | | 299 | mkdir_p $wrkdir/$_dst |
300 | fi | | 300 | fi |
301 | $cpprog -r $_src/* $wrkdir/$_dst | | 301 | $cpprog -r $_src/* $wrkdir/$_dst |
302 | } | | 302 | } |
303 | | | 303 | |
304 | get_optarg() | | 304 | get_optarg() |
305 | { | | 305 | { |
306 | expr "x$1" : "x[^=]*=\\(.*\\)" | | 306 | expr "x$1" : "x[^=]*=\\(.*\\)" |
307 | } | | 307 | } |
308 | | | 308 | |
309 | checkarg_sane_absolute_path() { | | 309 | checkarg_sane_absolute_path() { |
310 | case "$1" in | | 310 | case "$1" in |
311 | "") ;; # the default value will be used. | | 311 | "") ;; # the default value will be used. |
312 | *[!-A-Za-z0-9_./]*) | | 312 | *[!-A-Za-z0-9_./]*) |
313 | die "ERROR: Invalid characters in path $1 (from $2)." ;; | | 313 | die "ERROR: Invalid characters in path $1 (from $2)." ;; |
314 | */) die "ERROR: The argument to $2 must not end in /." ;; | | 314 | */) die "ERROR: The argument to $2 must not end in /." ;; |
315 | /*) ;; | | 315 | /*) ;; |
316 | *) die "ERROR: The argument to $2 must be an absolute path." ;; | | 316 | *) die "ERROR: The argument to $2 must be an absolute path." ;; |
317 | esac | | 317 | esac |
318 | } | | 318 | } |
319 | | | 319 | |
320 | checkarg_sane_relative_path() { | | 320 | checkarg_sane_relative_path() { |
321 | case "$1" in | | 321 | case "$1" in |
322 | "") ;; # the default value will be used. | | 322 | "") ;; # the default value will be used. |
323 | *[!-A-Za-z0-9_./]*) | | 323 | *[!-A-Za-z0-9_./]*) |
324 | die "ERROR: Invalid characters in path $1 (from $2)." ;; | | 324 | die "ERROR: Invalid characters in path $1 (from $2)." ;; |
325 | /*) die "ERROR: The argument to $2 must be a relative path." ;; | | 325 | /*) die "ERROR: The argument to $2 must be a relative path." ;; |
326 | *) ;; | | 326 | *) ;; |
327 | esac | | 327 | esac |
328 | } | | 328 | } |
329 | | | 329 | |
330 | bootstrap_sh=${SH-/bin/sh} | | 330 | bootstrap_sh=${SH-/bin/sh} |
331 | bootstrap_sh_set=${SH+set} | | 331 | bootstrap_sh_set=${SH+set} |
332 | | | 332 | |
333 | case "$bootstrap_sh" in | | 333 | case "$bootstrap_sh" in |
334 | /*) | | 334 | /*) |
335 | ;; | | 335 | ;; |
336 | *) | | 336 | *) |
337 | echo "ERROR: The variable SH must contain an absolute path" 1>&2 | | 337 | echo "ERROR: The variable SH must contain an absolute path" 1>&2 |
338 | exit 1 | | 338 | exit 1 |
339 | ;; | | 339 | ;; |
340 | esac | | 340 | esac |
341 | | | 341 | |
342 | # On some newer Ubuntu installations, /bin/sh is a symlink to /bin/dash, | | 342 | # On some newer Ubuntu installations, /bin/sh is a symlink to /bin/dash, |
343 | # whose echo(1) is not BSD-compatible. | | 343 | # whose echo(1) is not BSD-compatible. |
344 | dash_echo_test=`$bootstrap_sh -c 'echo "\\100"'` | | 344 | dash_echo_test=`$bootstrap_sh -c 'echo "\\100"'` |
345 | if [ "$dash_echo_test" = "@" ]; then | | 345 | if [ "$dash_echo_test" = "@" ]; then |
346 | { echo "ERROR: Your shell's echo command is not BSD-compatible." | | 346 | { echo "ERROR: Your shell's echo command is not BSD-compatible." |
347 | echo "ERROR: Please select another shell by setting the environment" | | 347 | echo "ERROR: Please select another shell by setting the environment" |
348 | echo "ERROR: variable SH." | | 348 | echo "ERROR: variable SH." |
349 | } 1>&2 | | 349 | } 1>&2 |
350 | exit 1; | | 350 | exit 1; |
351 | fi | | 351 | fi |
352 | | | 352 | |
353 | if [ -n "$PKG_PATH" ]; then | | 353 | if [ -n "$PKG_PATH" ]; then |
354 | echo "ERROR: Please unset PKG_PATH before running bootstrap." 1>&2 | | 354 | echo "ERROR: Please unset PKG_PATH before running bootstrap." 1>&2 |
355 | exit 1; | | 355 | exit 1; |
356 | fi | | 356 | fi |
357 | | | 357 | |
358 | build_start=`date` | | 358 | build_start=`date` |
359 | echo_msg "bootstrap command: $0 $@" | | 359 | echo_msg "bootstrap command: $0 $@" |
360 | echo_msg "bootstrap started: $build_start" | | 360 | echo_msg "bootstrap started: $build_start" |
361 | | | 361 | |
362 | # ensure system locations are empty; we will set them later when we know | | 362 | # ensure system locations are empty; we will set them later when we know |
363 | # whether they will be system wide or user specific | | 363 | # whether they will be system wide or user specific |
364 | prefix= | | 364 | prefix= |
365 | pkgdbdir= | | 365 | pkgdbdir= |
366 | pkgmandir= | | 366 | pkgmandir= |
367 | sysconfdir= | | 367 | sysconfdir= |
368 | varbase= | | 368 | varbase= |
369 | | | 369 | |
370 | full=no | | 370 | full=no |
371 | compiler="" | | 371 | compiler="" |
372 | quiet=no | | 372 | quiet=no |
373 | mk_fragment= | | 373 | mk_fragment= |
374 | | | 374 | |
375 | while [ $# -gt 0 ]; do | | 375 | while [ $# -gt 0 ]; do |
376 | case $1 in | | 376 | case $1 in |
377 | --workdir=*) wrkdir=`get_optarg "$1"` ;; | | 377 | --workdir=*) wrkdir=`get_optarg "$1"` ;; |
378 | --workdir) wrkdir="$2"; shift ;; | | 378 | --workdir) wrkdir="$2"; shift ;; |
379 | --prefix=*) prefix=`get_optarg "$1"` ;; | | 379 | --prefix=*) prefix=`get_optarg "$1"` ;; |
380 | --prefix) prefix="$2"; shift ;; | | 380 | --prefix) prefix="$2"; shift ;; |
381 | --pkgdbdir=*) pkgdbdir=`get_optarg "$1"` ;; | | 381 | --pkgdbdir=*) pkgdbdir=`get_optarg "$1"` ;; |
382 | --pkgdbdir) pkgdbdir="$2"; shift ;; | | 382 | --pkgdbdir) pkgdbdir="$2"; shift ;; |
383 | --pkgmandir=*) pkgmandir=`get_optarg "$1"` ;; | | 383 | --pkgmandir=*) pkgmandir=`get_optarg "$1"` ;; |
384 | --pkgmandir) pkgmandir="$2"; shift ;; | | 384 | --pkgmandir) pkgmandir="$2"; shift ;; |
385 | --sysconfdir=*) sysconfdir=`get_optarg "$1"` ;; | | 385 | --sysconfdir=*) sysconfdir=`get_optarg "$1"` ;; |
386 | --sysconfdir) sysconfdir="$2"; shift ;; | | 386 | --sysconfdir) sysconfdir="$2"; shift ;; |
387 | --varbase=*) varbase=`get_optarg "$1"` ;; | | 387 | --varbase=*) varbase=`get_optarg "$1"` ;; |
388 | --varbase) varbase="$2"; shift ;; | | 388 | --varbase) varbase="$2"; shift ;; |
389 | --compiler=*) compiler=`get_optarg "$1"` ;; | | 389 | --compiler=*) compiler=`get_optarg "$1"` ;; |
390 | --compiler) compiler="$2"; shift ;; | | 390 | --compiler) compiler="$2"; shift ;; |
391 | --abi=*) abi=`get_optarg "$1"` ;; | | 391 | --abi=*) abi=`get_optarg "$1"` ;; |
392 | --abi) abi="$2"; shift ;; | | 392 | --abi) abi="$2"; shift ;; |
393 | --unprivileged | --ignore-user-check) unprivileged=yes ;; | | 393 | --unprivileged | --ignore-user-check) unprivileged=yes ;; |
394 | --prefer-pkgsrc=*) | | 394 | --prefer-pkgsrc=*) |
395 | prefer_pkgsrc=`get_optarg "$1"` ;; | | 395 | prefer_pkgsrc=`get_optarg "$1"` ;; |
396 | --prefer-pkgsrc) | | 396 | --prefer-pkgsrc) |
397 | prefer_pkgsrc="$2"; shift ;; | | 397 | prefer_pkgsrc="$2"; shift ;; |
398 | --preserve-path) preserve_path=yes ;; | | 398 | --preserve-path) preserve_path=yes ;; |
399 | --mk-fragment=*) | | 399 | --mk-fragment=*) |
400 | mk_fragment=`get_optarg "$1"` ;; | | 400 | mk_fragment=`get_optarg "$1"` ;; |
401 | --mk-fragment) | | 401 | --mk-fragment) |
402 | mk_fragment="$2"; shift ;; | | 402 | mk_fragment="$2"; shift ;; |
403 | --binary-kit=*) | | 403 | --binary-kit=*) |
404 | binary_kit=`get_optarg "$1"` ;; | | 404 | binary_kit=`get_optarg "$1"` ;; |
405 | --binary-kit) | | 405 | --binary-kit) |
406 | binary_kit="$2"; shift ;; | | 406 | binary_kit="$2"; shift ;; |
407 | --gzip-binary-kit=*) | | 407 | --gzip-binary-kit=*) |
408 | binary_gzip_kit=`get_optarg "$1"` ;; | | 408 | binary_gzip_kit=`get_optarg "$1"` ;; |
409 | --gzip-binary-kit) | | 409 | --gzip-binary-kit) |
410 | binary_gzip_kit="$2"; shift ;; | | 410 | binary_gzip_kit="$2"; shift ;; |
411 | --binary-macpkg=*) | | 411 | --binary-macpkg=*) |
412 | binary_macpkg=`get_optarg "$1"` ;; | | 412 | binary_macpkg=`get_optarg "$1"` ;; |
413 | --binary-macpkg) | | 413 | --binary-macpkg) |
414 | binary_macpkg="$2"; shift ;; | | 414 | binary_macpkg="$2"; shift ;; |
415 | --full) full=yes ;; | | 415 | --full) full=yes ;; |
416 | --quiet) quiet=yes ;; | | 416 | --quiet) quiet=yes ;; |
417 | --help) echo "$usage"; exit ;; | | 417 | --help) echo "$usage"; exit ;; |
418 | -h) echo "$usage"; exit ;; | | 418 | -h) echo "$usage"; exit ;; |
419 | --*) echo "$usage"; exit 1 ;; | | 419 | --*) echo "$usage"; exit 1 ;; |
420 | esac | | 420 | esac |
421 | shift | | 421 | shift |
422 | done | | 422 | done |
423 | | | 423 | |
424 | checkarg_sane_absolute_path "$wrkdir" "--workdir" | | 424 | checkarg_sane_absolute_path "$wrkdir" "--workdir" |
425 | checkarg_sane_absolute_path "$prefix" "--prefix" | | 425 | checkarg_sane_absolute_path "$prefix" "--prefix" |
426 | checkarg_sane_absolute_path "$pkgdbdir" "--pkgdbdir" | | 426 | checkarg_sane_absolute_path "$pkgdbdir" "--pkgdbdir" |
427 | checkarg_sane_absolute_path "$sysconfdir" "--sysconfdir" | | 427 | checkarg_sane_absolute_path "$sysconfdir" "--sysconfdir" |
428 | checkarg_sane_absolute_path "$varbase" "--varbase" | | 428 | checkarg_sane_absolute_path "$varbase" "--varbase" |
429 | checkarg_sane_relative_path "$pkgmandir" "--pkgmandir" | | 429 | checkarg_sane_relative_path "$pkgmandir" "--pkgmandir" |
430 | | | 430 | |
431 | # set defaults for system locations if not already set by the user | | 431 | # set defaults for system locations if not already set by the user |
432 | wrkobjdir=${wrkdir}/pkgsrc | | 432 | wrkobjdir=${wrkdir}/pkgsrc |
433 | if [ "$unprivileged" = "yes" ]; then | | 433 | if [ "$unprivileged" = "yes" ]; then |
434 | [ -z "$prefix" ] && prefix=${HOME}/pkg | | 434 | [ -z "$prefix" ] && prefix=${HOME}/pkg |
435 | elif [ -z "$prefix" -o "$prefix" = "/usr/pkg" ]; then | | 435 | elif [ -z "$prefix" -o "$prefix" = "/usr/pkg" ]; then |
436 | prefix=/usr/pkg | | 436 | prefix=/usr/pkg |
437 | [ -z "$varbase" ] && varbase=/var | | 437 | [ -z "$varbase" ] && varbase=/var |
438 | fi | | 438 | fi |
439 | | | 439 | |
440 | [ -z "$varbase" ] && varbase=${prefix}/var | | 440 | [ -z "$varbase" ] && varbase=${prefix}/var |
441 | [ -z "$pkgdbdir" ] && pkgdbdir=${varbase}/db/pkg | | 441 | [ -z "$pkgdbdir" ] && pkgdbdir=${varbase}/db/pkg |
442 | | | 442 | |
443 | if [ "$prefix" = "/usr" ]; then | | 443 | if [ "$prefix" = "/usr" ]; then |
444 | [ -z "$pkgmandir" ] && pkgmandir=share/man | | 444 | [ -z "$pkgmandir" ] && pkgmandir=share/man |
445 | else | | 445 | else |
446 | [ -z "$pkgmandir" ] && pkgmandir=man | | 446 | [ -z "$pkgmandir" ] && pkgmandir=man |
447 | fi | | 447 | fi |
448 | mandir=${prefix}/${pkgmandir} | | 448 | mandir=${prefix}/${pkgmandir} |
449 | [ -z "$sysconfdir" ] && sysconfdir=${prefix}/etc | | 449 | [ -z "$sysconfdir" ] && sysconfdir=${prefix}/etc |
450 | | | 450 | |
451 | if [ "x$preserve_path" != "xyes" ]; then | | 451 | if [ "x$preserve_path" != "xyes" ]; then |
452 | PATH="$PATH:/sbin:/usr/sbin" | | 452 | PATH="$PATH:/sbin:/usr/sbin" |
453 | fi | | 453 | fi |
454 | | | 454 | |
455 | overpath="" | | 455 | overpath="" |
456 | root_user=root | | 456 | root_user=root |
457 | bmakexenv= | | 457 | bmakexenv= |
458 | bmakexargs= | | 458 | bmakexargs= |
459 | need_extras=no | | 459 | need_extras=no |
460 | case "$opsys" in | | 460 | case "$opsys" in |
461 | AIX) | | 461 | AIX) |
462 | root_group=system | | 462 | root_group=system |
463 | need_bsd_install=yes | | 463 | need_bsd_install=yes |
464 | need_awk=yes | | 464 | need_awk=yes |
465 | need_sed=yes | | 465 | need_sed=yes |
466 | need_fixed_strip=yes | | 466 | need_fixed_strip=yes |
467 | set_opsys=no | | 467 | set_opsys=no |
468 | machine_arch=`get_machine_arch_aix` | | 468 | machine_arch=`get_machine_arch_aix` |
469 | ;; | | 469 | ;; |
470 | CYGWIN_*) | | 470 | CYGWIN_*) |
471 | is_root () { | | 471 | is_root () { |
472 | if id -nG | grep -q 'Administrators'; then | | 472 | if id -nG | grep -q 'Administrators'; then |
473 | return 0 | | 473 | return 0 |
474 | fi | | 474 | fi |
475 | return 1 | | 475 | return 1 |
476 | } | | 476 | } |
477 | root_user=Administrators | | 477 | root_user=Administrators |
478 | root_group=Administrators | | 478 | root_group=Administrators |
479 | need_bsd_install=no | | 479 | need_bsd_install=no |
480 | opsys=`uname -o` | | 480 | opsys=`uname -o` |
481 | need_awk=no | | 481 | need_awk=no |
482 | need_sed=no | | 482 | need_sed=no |
483 | need_xargs=no | | 483 | need_xargs=no |
484 | # only used for unprivileged builds. | | 484 | # only used for unprivileged builds. |
485 | whoamiprog='id -u' | | 485 | whoamiprog='id -u' |
486 | groupsprog='id -g' | | 486 | groupsprog='id -g' |
487 | ;; | | 487 | ;; |
488 | | | 488 | |
489 | Darwin) | | 489 | Darwin) |
490 | root_group=wheel | | 490 | root_group=wheel |
491 | need_bsd_install=no | | 491 | need_bsd_install=no |
492 | need_awk=no | | 492 | need_awk=no |
493 | need_sed=no | | 493 | need_sed=no |
494 | set_opsys=no | | 494 | set_opsys=no |
495 | machine_arch=`uname -p` | | 495 | machine_arch=`uname -p` |
496 | CC=${CC:-"gcc -isystem /usr/include"}; export CC | | 496 | CC=${CC:-"gcc -isystem /usr/include"}; export CC |
497 | osrev=`uname -r` | | 497 | osrev=`uname -r` |
498 | macosx_version=`echo $osrev | awk -F . '{ print "10."$1-4; }'` | | 498 | macosx_version=`echo $osrev | awk -F . '{ print "10."$1-4; }'` |
499 | case "$macosx_version" in | | 499 | case "$macosx_version" in |
500 | 10.[0-4]) | | 500 | 10.[0-4]) |
501 | packagemaker=/Developer/Tools/packagemaker | | 501 | packagemaker=/Developer/Tools/packagemaker |
502 | ;; | | 502 | ;; |
503 | *) | | 503 | *) |
504 | packagemaker=/Developer/usr/bin/packagemaker | | 504 | packagemaker=/Developer/usr/bin/packagemaker |
505 | ;; | | 505 | ;; |
506 | esac | | 506 | esac |
507 | unset osrev macosx_version | | 507 | unset osrev macosx_version |
508 | ;; | | 508 | ;; |
509 | DragonFly) | | 509 | DragonFly) |
510 | root_group=wheel | | 510 | root_group=wheel |
511 | need_bsd_install=no | | 511 | need_bsd_install=no |
512 | need_awk=no | | 512 | need_awk=no |
513 | need_sed=no | | 513 | need_sed=no |
514 | set_opsys=no | | 514 | set_opsys=no |
515 | check_prog tarprog tar | | 515 | check_prog tarprog tar |
516 | machine_arch=`uname -p` | | 516 | machine_arch=`uname -p` |
517 | ;; | | 517 | ;; |
518 | FreeBSD) | | 518 | FreeBSD) |
519 | root_group=wheel | | 519 | root_group=wheel |
520 | need_bsd_install=no | | 520 | need_bsd_install=no |
521 | need_awk=no | | 521 | need_awk=no |
522 | need_sed=no | | 522 | need_sed=no |
523 | set_opsys=no | | 523 | set_opsys=no |
524 | machine_arch=`uname -p` | | 524 | machine_arch=`uname -p` |
525 | ;; | | 525 | ;; |
526 | Haiku) | | 526 | Haiku) |
527 | root_user=`id -un` | | 527 | root_user=`id -un` |
528 | root_group=root | | 528 | root_group=root |
529 | need_bsd_install=no | | 529 | need_bsd_install=no |
530 | need_awk=no | | 530 | need_awk=no |
531 | need_sed=no | | 531 | need_sed=no |
532 | set_opsys=no | | 532 | set_opsys=no |
533 | case `uname -m` in | | 533 | case `uname -m` in |
534 | BeMac) | | 534 | BeMac) |
535 | machine_arch=powerpc | | 535 | machine_arch=powerpc |
536 | ;; | | 536 | ;; |
537 | BePC) | | 537 | BePC) |
538 | machine_arch=i386 | | 538 | machine_arch=i386 |
539 | ;; | | 539 | ;; |
540 | *) | | 540 | *) |
541 | machine_arch=`uname -p` | | 541 | machine_arch=`uname -p` |
542 | ;; | | 542 | ;; |
543 | esac | | 543 | esac |
544 | ;; | | 544 | ;; |
545 | HPUX) | | 545 | HPUX) |
546 | root_group=sys | | 546 | root_group=sys |
547 | need_bsd_install=yes | | 547 | need_bsd_install=yes |
548 | need_awk=yes | | 548 | need_awk=yes |
549 | need_sed=yes | | 549 | need_sed=yes |
550 | set_opsys=no | | 550 | set_opsys=no |
551 | machine_arch=`uname -m | sed 's/^9000.*$/hppa/'` | | 551 | machine_arch=`uname -m | sed 's/^9000.*$/hppa/'` |
552 | ;; | | 552 | ;; |
553 | Interix) | | 553 | Interix) |
554 | is_root () { | | 554 | is_root () { |
555 | if id -G | grep -q 131616; then | | 555 | if id -G | grep -q 131616; then |
556 | return 0 | | 556 | return 0 |
557 | fi | | 557 | fi |
558 | return 1 | | 558 | return 1 |
559 | } | | 559 | } |
560 | mkdir_p () { | | 560 | mkdir_p () { |
561 | mkdir -p "$@" # allows umask to take effect | | 561 | mkdir -p "$@" # allows umask to take effect |
562 | } | | 562 | } |
563 | default_install_mode=0775 | | 563 | default_install_mode=0775 |
564 | root_user=`id -u` | | 564 | root_user=`id -u` |
565 | root_group=131616 | | 565 | root_group=131616 |
566 | case `uname -r` in | | 566 | case `uname -r` in |
567 | 3.* | 5.*) | | 567 | 3.* | 5.*) |
568 | need_bsd_install=yes | | 568 | need_bsd_install=yes |
569 | need_awk=yes | | 569 | need_awk=yes |
570 | need_sed=yes | | 570 | need_sed=yes |
571 | set_opsys=no | | 571 | set_opsys=no |
572 | need_xargs=yes | | 572 | need_xargs=yes |
573 | ;; | | 573 | ;; |
574 | *) | | 574 | *) |
575 | need_bsd_install=no | | 575 | need_bsd_install=no |
576 | need_awk=no | | 576 | need_awk=no |
577 | need_sed=no | | 577 | need_sed=no |
578 | set_opsys=no | | 578 | set_opsys=no |
579 | need_xargs=no | | 579 | need_xargs=no |
580 | ;; | | 580 | ;; |
581 | esac | | 581 | esac |
582 | # only used for unprivileged builds | | 582 | # only used for unprivileged builds |
583 | groupsprog="id -gn" | | 583 | groupsprog="id -gn" |
584 | # for bootstrap only; pkgsrc uses CPPFLAGS | | 584 | # for bootstrap only; pkgsrc uses CPPFLAGS |
585 | CC="gcc -D_ALL_SOURCE"; export CC | | 585 | CC="gcc -D_ALL_SOURCE"; export CC |
586 | ac_cv_header_poll_h=no; export ac_cv_header_poll_h | | 586 | ac_cv_header_poll_h=no; export ac_cv_header_poll_h |
587 | ac_cv_func_poll=no; export ac_cv_func_poll | | 587 | ac_cv_func_poll=no; export ac_cv_func_poll |
588 | ;; | | 588 | ;; |
589 | IRIX*) | | 589 | IRIX*) |
590 | if [ -d "/usr/freeware/bin" ]; then | | 590 | if [ -d "/usr/freeware/bin" ]; then |
591 | overpath="/usr/freeware/bin:$overpath" | | 591 | overpath="/usr/freeware/bin:$overpath" |
592 | fi | | 592 | fi |
593 | if [ -d "/usr/bsd" ]; then | | 593 | if [ -d "/usr/bsd" ]; then |
594 | overpath="/usr/bsd:$overpath" | | 594 | overpath="/usr/bsd:$overpath" |
595 | fi | | 595 | fi |
596 | if [ -d "/usr/bsd/bin" ]; then | | 596 | if [ -d "/usr/bsd/bin" ]; then |
597 | overpath="/usr/bsd/bin:$overpath" | | 597 | overpath="/usr/bsd/bin:$overpath" |
598 | fi | | 598 | fi |
599 | root_group=sys | | 599 | root_group=sys |
600 | need_bsd_install=yes | | 600 | need_bsd_install=yes |
601 | get_abi "IRIX" | | 601 | get_abi "IRIX" |
602 | opsys=IRIX | | 602 | opsys=IRIX |
603 | need_awk=yes | | 603 | need_awk=yes |
604 | need_sed=yes | | 604 | need_sed=yes |
605 | set_opsys=yes | | 605 | set_opsys=yes |
606 | machine_arch=mipseb | | 606 | machine_arch=mipseb |
607 | bmakexargs="MACHINE_ARCH=$machine_arch" | | 607 | bmakexargs="MACHINE_ARCH=$machine_arch" |
608 | bmakexenv="MAKE=pmake" | | 608 | bmakexenv="MAKE=pmake" |
609 | check_compiler=yes | | 609 | check_compiler=yes |
610 | if [ `uname -r` -lt 6 ]; then | | 610 | if [ `uname -r` -lt 6 ]; then |
611 | # IRIX 5's mkdir bails out with an error when trying to create with the -p | | 611 | # IRIX 5's mkdir bails out with an error when trying to create with the -p |
612 | # option an already existing directory | | 612 | # option an already existing directory |
613 | need_mkdir=yes | | 613 | need_mkdir=yes |
614 | fi | | 614 | fi |
615 | ;; | | 615 | ;; |
616 | Linux) | | 616 | Linux) |
617 | if [ -f /etc/ssdlinux_version ]; then | | 617 | if [ -f /etc/ssdlinux_version ]; then |
618 | root_group=wheel | | 618 | root_group=wheel |
619 | else | | 619 | else |
620 | root_group=root | | 620 | root_group=root |
621 | fi | | 621 | fi |
622 | need_bsd_install=no | | 622 | need_bsd_install=no |
623 | need_awk=no | | 623 | # Debian/Ubuntu's awk is mawk, and mawk does not understand |
| | | 624 | # some regexp used in pkgsrc/mk. |
| | | 625 | if [ -f /etc/debian_version ]; then |
| | | 626 | need_awk=yes |
| | | 627 | else |
| | | 628 | need_awk=no |
| | | 629 | fi |
624 | need_sed=no | | 630 | need_sed=no |
625 | set_opsys=no | | 631 | set_opsys=no |
626 | machine_arch=`uname -m | sed -e 's/i.86/i386/'` | | 632 | machine_arch=`uname -m | sed -e 's/i.86/i386/'` |
627 | ;; | | 633 | ;; |
628 | Minix) | | 634 | Minix) |
629 | root_group=operator | | 635 | root_group=operator |
630 | need_bsd_install=yes | | 636 | need_bsd_install=yes |
631 | need_awk=no | | 637 | need_awk=no |
632 | need_sed=no | | 638 | need_sed=no |
633 | set_opsys=no | | 639 | set_opsys=no |
634 | machine_arch=`uname -p` | | 640 | machine_arch=`uname -p` |
635 | LDFLAGS="-lcompat_minix -lminlib" | | 641 | LDFLAGS="-lcompat_minix -lminlib" |
636 | ;; | | 642 | ;; |
637 | MirBSD) | | 643 | MirBSD) |
638 | root_group=wheel | | 644 | root_group=wheel |
639 | need_pax=yes | | 645 | need_pax=yes |
640 | need_mtree=no | | 646 | need_mtree=no |
641 | need_bsd_install=no | | 647 | need_bsd_install=no |
642 | need_awk=no | | 648 | need_awk=no |
643 | need_sed=no | | 649 | need_sed=no |
644 | set_opsys=no | | 650 | set_opsys=no |
645 | check_prog mtreeprog mtree | | 651 | check_prog mtreeprog mtree |
646 | machine_arch=`arch -s` | | 652 | machine_arch=`arch -s` |
647 | # there is no /usr/bin/cc, so use mgcc if unset | | 653 | # there is no /usr/bin/cc, so use mgcc if unset |
648 | test -n "$CC" || { CC=mgcc; export CC; } | | 654 | test -n "$CC" || { CC=mgcc; export CC; } |
649 | # get some variables from the native make if unset | | 655 | # get some variables from the native make if unset |
650 | for var in CFLAGS CPPFLAGS LDFLAGS; do | | 656 | for var in CFLAGS CPPFLAGS LDFLAGS; do |
651 | # check if variable is already set | | 657 | # check if variable is already set |
652 | eval _tmp=\"\$$var\" | | 658 | eval _tmp=\"\$$var\" |
653 | [ "x$_tmp" != x ] && continue | | 659 | [ "x$_tmp" != x ] && continue |
654 | # ask the native make (EXPERIMENTAL = don't add -Werror) | | 660 | # ask the native make (EXPERIMENTAL = don't add -Werror) |
655 | # the -I${.CURDIR} dance is to prevent junk in CPPFLAGS | | 661 | # the -I${.CURDIR} dance is to prevent junk in CPPFLAGS |
656 | _tmp=`printf '%s\nall:\n\t@%s %%s %s=${%s:M*:Q:Q}\n%s\n%s\n' \ | | 662 | _tmp=`printf '%s\nall:\n\t@%s %%s %s=${%s:M*:Q:Q}\n%s\n%s\n' \ |
657 | $var'+=-I${.CURDIR}' printf $var $var':S/-I${.CURDIR}//' \ | | 663 | $var'+=-I${.CURDIR}' printf $var $var':S/-I${.CURDIR}//' \ |
658 | EXPERIMENTAL=yes '.include <bsd.prog.mk>' | \ | | 664 | EXPERIMENTAL=yes '.include <bsd.prog.mk>' | \ |
659 | (unset MAKECONF; /usr/bin/make -f - all 2>/dev/null) | \ | | 665 | (unset MAKECONF; /usr/bin/make -f - all 2>/dev/null) | \ |
660 | sed 's/^x//'` | | 666 | sed 's/^x//'` |
661 | eval $_tmp | | 667 | eval $_tmp |
662 | eval export $var | | 668 | eval export $var |
663 | done | | 669 | done |
664 | ;; | | 670 | ;; |
665 | NetBSD) | | 671 | NetBSD) |
666 | root_group=wheel | | 672 | root_group=wheel |
667 | need_bsd_install=no | | 673 | need_bsd_install=no |
668 | need_awk=no | | 674 | need_awk=no |
669 | need_sed=no | | 675 | need_sed=no |
670 | set_opsys=no | | 676 | set_opsys=no |
671 | machine_arch=`uname -p` | | 677 | machine_arch=`uname -p` |
672 | ;; | | 678 | ;; |
673 | OpenBSD) | | 679 | OpenBSD) |
674 | root_group=wheel | | 680 | root_group=wheel |
675 | need_bsd_install=no | | 681 | need_bsd_install=no |
676 | need_awk=no | | 682 | need_awk=no |
677 | need_sed=no | | 683 | need_sed=no |
678 | set_opsys=no | | 684 | set_opsys=no |
679 | machine_arch=`uname -m` | | 685 | machine_arch=`uname -m` |
680 | ;; | | 686 | ;; |
681 | OSF1) | | 687 | OSF1) |
682 | root_group=system | | 688 | root_group=system |
683 | need_bsd_install=yes | | 689 | need_bsd_install=yes |
684 | need_awk=yes | | 690 | need_awk=yes |
685 | need_sed=yes | | 691 | need_sed=yes |
686 | need_ksh=yes | | 692 | need_ksh=yes |
687 | set_opsys=no | | 693 | set_opsys=no |
688 | ;; | | 694 | ;; |
689 | QNX) | | 695 | QNX) |
690 | root_group=root | | 696 | root_group=root |
691 | need_bsd_install=yes | | 697 | need_bsd_install=yes |
692 | need_awk=yes | | 698 | need_awk=yes |
693 | need_sed=yes | | 699 | need_sed=yes |
694 | set_opsys=no | | 700 | set_opsys=no |
695 | groupsprog="id -gn" | | 701 | groupsprog="id -gn" |
696 | whoamiprog="id -un" | | 702 | whoamiprog="id -un" |
697 | machine_arch=`uname -p | sed -e 's/x86/i386/'` | | 703 | machine_arch=`uname -p | sed -e 's/x86/i386/'` |
698 | ;; | | 704 | ;; |
699 | SunOS) | | 705 | SunOS) |
700 | root_group=root | | 706 | root_group=root |
701 | need_bsd_install=yes | | 707 | need_bsd_install=yes |
702 | if [ -x "/usr/gnu/bin/awk" ]; then | | 708 | if [ -x "/usr/gnu/bin/awk" ]; then |
703 | need_awk=no | | 709 | need_awk=no |
704 | else | | 710 | else |
705 | need_awk=yes | | 711 | need_awk=yes |
706 | fi | | 712 | fi |
707 | if [ -x "/usr/gnu/bin/sed" ]; then | | 713 | if [ -x "/usr/gnu/bin/sed" ]; then |
708 | need_sed=no | | 714 | need_sed=no |
709 | else | | 715 | else |
710 | need_sed=yes | | 716 | need_sed=yes |
711 | fi | | 717 | fi |
712 | if [ "`uname -r`" = "5.11" -a -x "/usr/bin/bash" ]; then | | 718 | if [ "`uname -r`" = "5.11" -a -x "/usr/bin/bash" ]; then |
713 | bootstrap_sh=${SH:-/usr/bin/bash} | | 719 | bootstrap_sh=${SH:-/usr/bin/bash} |
714 | bootstrap_sh_set=set | | 720 | bootstrap_sh_set=set |
715 | else | | 721 | else |
716 | need_ksh=yes | | 722 | need_ksh=yes |
717 | fi | | 723 | fi |
718 | set_opsys=no | | 724 | set_opsys=no |
719 | idprog="/usr/xpg4/bin/id" | | 725 | idprog="/usr/xpg4/bin/id" |
720 | groupsprog="${idprog} -gn" | | 726 | groupsprog="${idprog} -gn" |
721 | whoamiprog="${idprog} -un" | | 727 | whoamiprog="${idprog} -un" |
722 | machine_arch=`uname -p | sed -e 's/i86pc/i386/'` | | 728 | machine_arch=`uname -p | sed -e 's/i86pc/i386/'` |
723 | check_compiler=yes | | 729 | check_compiler=yes |
724 | ;; | | 730 | ;; |
725 | UnixWare) | | 731 | UnixWare) |
726 | root_group=sys | | 732 | root_group=sys |
727 | need_bsd_install=no | | 733 | need_bsd_install=no |
728 | BSTRAP_ENV="INSTALL=/usr/ucb/install $BSTRAP_ENV" | | 734 | BSTRAP_ENV="INSTALL=/usr/ucb/install $BSTRAP_ENV" |
729 | need_mkdir=yes | | 735 | need_mkdir=yes |
730 | need_awk=yes | | 736 | need_awk=yes |
731 | need_sed=yes | | 737 | need_sed=yes |
732 | whoamiprog=/usr/ucb/whoami | | 738 | whoamiprog=/usr/ucb/whoami |
733 | set_opsys=no | | 739 | set_opsys=no |
734 | CC="gcc -DUNIXWARE"; export CC | | 740 | CC="gcc -DUNIXWARE"; export CC |
735 | ;; | | 741 | ;; |
736 | *) | | 742 | *) |
737 | echo "This platform ($opsys) is untried - good luck, and thanks for using pkgsrc" | | 743 | echo "This platform ($opsys) is untried - good luck, and thanks for using pkgsrc" |
738 | root_group=wheel | | 744 | root_group=wheel |
739 | need_bsd_install=yes | | 745 | need_bsd_install=yes |
740 | need_awk=yes | | 746 | need_awk=yes |
741 | need_sed=yes | | 747 | need_sed=yes |
742 | set_opsys=no | | 748 | set_opsys=no |
743 | ;; | | 749 | ;; |
744 | esac | | 750 | esac |
745 | | | 751 | |
746 | # If "--full" is specified, then install all of the platform-independent | | 752 | # If "--full" is specified, then install all of the platform-independent |
747 | # bootstrap software. | | 753 | # bootstrap software. |
748 | # | | 754 | # |
749 | case "$full" in | | 755 | case "$full" in |
750 | yes) | | 756 | yes) |
751 | need_bsd_install=yes | | 757 | need_bsd_install=yes |
752 | need_awk=yes | | 758 | need_awk=yes |
753 | need_sed=yes | | 759 | need_sed=yes |
754 | need_ksh=yes | | 760 | need_ksh=yes |
755 | ;; | | 761 | ;; |
756 | esac | | 762 | esac |
757 | | | 763 | |
758 | case "$quiet" in | | 764 | case "$quiet" in |
759 | yes) | | 765 | yes) |
760 | configure_quiet_flags="--quiet" | | 766 | configure_quiet_flags="--quiet" |
761 | make_quiet_flags="-s" | | 767 | make_quiet_flags="-s" |
762 | ;; | | 768 | ;; |
763 | no) | | 769 | no) |
764 | configure_quiet_flags="" | | 770 | configure_quiet_flags="" |
765 | make_quiet_flags="" | | 771 | make_quiet_flags="" |
766 | esac | | 772 | esac |
767 | | | 773 | |
768 | # export OPSYS and MACHINE_ARCH for pkg_install. we only set | | 774 | # export OPSYS and MACHINE_ARCH for pkg_install. we only set |
769 | # MACHINE_ARCH on platforms where we override bmake's value. | | 775 | # MACHINE_ARCH on platforms where we override bmake's value. |
770 | OPSYS=${opsys} | | 776 | OPSYS=${opsys} |
771 | export OPSYS | | 777 | export OPSYS |
772 | if [ "${machine_arch}" != "" ]; then | | 778 | if [ "${machine_arch}" != "" ]; then |
773 | MACHINE_ARCH=${machine_arch} | | 779 | MACHINE_ARCH=${machine_arch} |
774 | export MACHINE_ARCH | | 780 | export MACHINE_ARCH |
775 | fi | | 781 | fi |
776 | | | 782 | |
777 | if [ "x$preserve_path" != "xyes" ]; then | | 783 | if [ "x$preserve_path" != "xyes" ]; then |
778 | PATH="$overpath:$PATH" | | 784 | PATH="$overpath:$PATH" |
779 | fi | | 785 | fi |
780 | | | 786 | |
781 | check_prog awkprog awk | | 787 | check_prog awkprog awk |
782 | check_prog chmodprog chmod | | 788 | check_prog chmodprog chmod |
783 | if [ -n "$CP" ]; then | | 789 | if [ -n "$CP" ]; then |
784 | cpprog="$CP" | | 790 | cpprog="$CP" |
785 | else | | 791 | else |
786 | check_prog cpprog cp | | 792 | check_prog cpprog cp |
787 | fi | | 793 | fi |
788 | if [ -n "$ID" ]; then | | 794 | if [ -n "$ID" ]; then |
789 | idprog="$ID" | | 795 | idprog="$ID" |
790 | else | | 796 | else |
791 | check_prog idprog id | | 797 | check_prog idprog id |
792 | fi | | 798 | fi |
793 | check_prog groupsprog groups | | 799 | check_prog groupsprog groups |
794 | check_prog lnprog ln | | 800 | check_prog lnprog ln |
795 | check_prog lsprog ls | | 801 | check_prog lsprog ls |
796 | check_prog rmdirprog rmdir | | 802 | check_prog rmdirprog rmdir |
797 | check_prog sedprog sed | | 803 | check_prog sedprog sed |
798 | check_prog shprog sh | | 804 | check_prog shprog sh |
799 | check_prog whoamiprog whoami | | 805 | check_prog whoamiprog whoami |
800 | | | 806 | |
801 | if [ -d "${wrkdir}" ] || [ -f "${wrkdir}" ]; then | | 807 | if [ -d "${wrkdir}" ] || [ -f "${wrkdir}" ]; then |
802 | echo "\"${wrkdir}\" already exists, please remove it or use --workdir."; | | 808 | echo "\"${wrkdir}\" already exists, please remove it or use --workdir."; |
803 | exit 1 | | 809 | exit 1 |
804 | fi | | 810 | fi |
805 | | | 811 | |
806 | mkdir_p_early ${wrkdir} | | 812 | mkdir_p_early ${wrkdir} |
807 | if touch ${wrkdir}/.writeable; then | | 813 | if touch ${wrkdir}/.writeable; then |
808 | : | | 814 | : |
809 | else | | 815 | else |
810 | echo "\"${wrkdir}\" is not writeable. Try $0 -h."; | | 816 | echo "\"${wrkdir}\" is not writeable. Try $0 -h."; |
811 | exit 1 | | 817 | exit 1 |
812 | fi | | 818 | fi |
813 | echo "Working directory is: ${wrkdir}" | | 819 | echo "Working directory is: ${wrkdir}" |
814 | | | 820 | |
815 | if [ "$compiler" = "" ] && [ x"$check_compiler" = x"yes" ]; then | | 821 | if [ "$compiler" = "" ] && [ x"$check_compiler" = x"yes" ]; then |
816 | get_compiler | | 822 | get_compiler |
817 | if [ $compiler_is_gnu -gt 0 ]; then | | 823 | if [ $compiler_is_gnu -gt 0 ]; then |
818 | compiler="gcc" | | 824 | compiler="gcc" |
819 | else | | 825 | else |
820 | case "$opsys" in | | 826 | case "$opsys" in |
821 | IRIX) | | 827 | IRIX) |
822 | if [ `uname -r` -ge 6 ]; then | | 828 | if [ `uname -r` -ge 6 ]; then |
823 | compiler="mipspro" | | 829 | compiler="mipspro" |
824 | else | | 830 | else |
825 | compiler="ido" | | 831 | compiler="ido" |
826 | fi | | 832 | fi |
827 | test -n "$CC" || CC=cc | | 833 | test -n "$CC" || CC=cc |
828 | ;; | | 834 | ;; |
829 | SunOS) compiler="sunpro" | | 835 | SunOS) compiler="sunpro" |
830 | test -n "$CC" || CC=cc | | 836 | test -n "$CC" || CC=cc |
831 | ;; | | 837 | ;; |
832 | esac | | 838 | esac |
833 | fi | | 839 | fi |
834 | fi | | 840 | fi |
835 | | | 841 | |
836 | mkdir_p_early ${wrkdir}/bin | | 842 | mkdir_p_early ${wrkdir}/bin |
837 | | | 843 | |
838 | # build install-sh | | 844 | # build install-sh |
839 | run_cmd "$sedprog -e 's|@DEFAULT_INSTALL_MODE@|'${default_install_mode-0755}'|' $pkgsrcdir/sysutils/install-sh/files/install-sh.in > $wrkdir/bin/install-sh" | | 845 | run_cmd "$sedprog -e 's|@DEFAULT_INSTALL_MODE@|'${default_install_mode-0755}'|' $pkgsrcdir/sysutils/install-sh/files/install-sh.in > $wrkdir/bin/install-sh" |
840 | run_cmd "$chmodprog +x $wrkdir/bin/install-sh" | | 846 | run_cmd "$chmodprog +x $wrkdir/bin/install-sh" |
841 | install_sh="$shprog $wrkdir/bin/install-sh" | | 847 | install_sh="$shprog $wrkdir/bin/install-sh" |
842 | | | 848 | |
843 | if [ $unprivileged = "yes" ]; then | | 849 | if [ $unprivileged = "yes" ]; then |
844 | user=`$whoamiprog` | | 850 | user=`$whoamiprog` |
845 | group=`$groupsprog | $awkprog '{print $1}'` | | 851 | group=`$groupsprog | $awkprog '{print $1}'` |
846 | echo_msg "building as unprivileged user $user/$group" | | 852 | echo_msg "building as unprivileged user $user/$group" |
847 | | | 853 | |
848 | # force bmake install target to use $user and $group | | 854 | # force bmake install target to use $user and $group |
849 | echo "BINOWN=$user | | 855 | echo "BINOWN=$user |
850 | BINGRP=$group | | 856 | BINGRP=$group |
851 | LIBOWN=$user | | 857 | LIBOWN=$user |
852 | LIBGRP=$group | | 858 | LIBGRP=$group |
853 | MANOWN=$user | | 859 | MANOWN=$user |
854 | MANGRP=$group" > ${wrkdir}/Makefile.inc | | 860 | MANGRP=$group" > ${wrkdir}/Makefile.inc |
855 | elif is_root; then | | 861 | elif is_root; then |
856 | user=$root_user | | 862 | user=$root_user |
857 | group=$root_group | | 863 | group=$root_group |
858 | else | | 864 | else |
859 | die "You must be either root to install bootstrap-pkgsrc or use the --unprivileged option." | | 865 | die "You must be either root to install bootstrap-pkgsrc or use the --unprivileged option." |
860 | fi | | 866 | fi |
861 | | | 867 | |
862 | # export the proper environment | | 868 | # export the proper environment |
863 | PATH=$prefix/bin:$prefix/sbin:${PATH}; export PATH | | 869 | PATH=$prefix/bin:$prefix/sbin:${PATH}; export PATH |
864 | if [ -d /usr/ccs/bin -a -x /usr/ccs/bin/make ]; then | | 870 | if [ -d /usr/ccs/bin -a -x /usr/ccs/bin/make ]; then |
865 | PATH=${PATH}:/usr/ccs/bin; export PATH | | 871 | PATH=${PATH}:/usr/ccs/bin; export PATH |
866 | fi | | 872 | fi |
867 | PKG_DBDIR=$pkgdbdir; export PKG_DBDIR | | 873 | PKG_DBDIR=$pkgdbdir; export PKG_DBDIR |
868 | LOCALBASE=$prefix; export LOCALBASE | | 874 | LOCALBASE=$prefix; export LOCALBASE |
869 | VARBASE=$varbase; export VARBASE | | 875 | VARBASE=$varbase; export VARBASE |
870 | | | 876 | |
871 | # set up an example mk.conf file | | 877 | # set up an example mk.conf file |
872 | TARGET_MKCONF=${wrkdir}/mk.conf.example | | 878 | TARGET_MKCONF=${wrkdir}/mk.conf.example |
873 | echo_msg "Creating default mk.conf in ${wrkdir}" | | 879 | echo_msg "Creating default mk.conf in ${wrkdir}" |
874 | echo "# Example ${sysconfdir}/mk.conf file produced by bootstrap-pkgsrc" > ${TARGET_MKCONF} | | 880 | echo "# Example ${sysconfdir}/mk.conf file produced by bootstrap-pkgsrc" > ${TARGET_MKCONF} |
875 | echo "# `date`" >> ${TARGET_MKCONF} | | 881 | echo "# `date`" >> ${TARGET_MKCONF} |
876 | echo "" >> ${TARGET_MKCONF} | | 882 | echo "" >> ${TARGET_MKCONF} |
877 | echo ".ifdef BSD_PKG_MK # begin pkgsrc settings" >> ${TARGET_MKCONF} | | 883 | echo ".ifdef BSD_PKG_MK # begin pkgsrc settings" >> ${TARGET_MKCONF} |
878 | echo "" >> ${TARGET_MKCONF} | | 884 | echo "" >> ${TARGET_MKCONF} |
879 | | | 885 | |
880 | # IRIX64 needs to be set to IRIX, for example | | 886 | # IRIX64 needs to be set to IRIX, for example |
881 | if [ "$set_opsys" = "yes" ]; then | | 887 | if [ "$set_opsys" = "yes" ]; then |
882 | echo "OPSYS= $opsys" >> ${TARGET_MKCONF} | | 888 | echo "OPSYS= $opsys" >> ${TARGET_MKCONF} |
883 | fi | | 889 | fi |
884 | | | 890 | |
885 | if [ -n "$abi" ]; then | | 891 | if [ -n "$abi" ]; then |
886 | echo "ABI= $abi" >> ${TARGET_MKCONF} | | 892 | echo "ABI= $abi" >> ${TARGET_MKCONF} |
887 | fi | | 893 | fi |
888 | if [ "$compiler" != "" ]; then | | 894 | if [ "$compiler" != "" ]; then |
889 | echo "PKGSRC_COMPILER= $compiler" >> ${TARGET_MKCONF} | | 895 | echo "PKGSRC_COMPILER= $compiler" >> ${TARGET_MKCONF} |
890 | fi | | 896 | fi |
891 | case "$compiler" in | | 897 | case "$compiler" in |
892 | sunpro) | | 898 | sunpro) |
893 | echo "CC= cc" >> ${TARGET_MKCONF} | | 899 | echo "CC= cc" >> ${TARGET_MKCONF} |
894 | echo "CXX= CC" >> ${TARGET_MKCONF} | | 900 | echo "CXX= CC" >> ${TARGET_MKCONF} |
895 | echo "CPP= \${CC} -E" >> ${TARGET_MKCONF} | | 901 | echo "CPP= \${CC} -E" >> ${TARGET_MKCONF} |
896 | ;; | | 902 | ;; |
897 | clang) | | 903 | clang) |
898 | echo "CC= clang" >> ${TARGET_MKCONF} | | 904 | echo "CC= clang" >> ${TARGET_MKCONF} |
899 | echo "CXX= clang++" >> ${TARGET_MKCONF} | | 905 | echo "CXX= clang++" >> ${TARGET_MKCONF} |
900 | echo "CPP= \${CC} -E" >> ${TARGET_MKCONF} | | 906 | echo "CPP= \${CC} -E" >> ${TARGET_MKCONF} |
901 | if [ -n "$CLANGBASE" -o -f "/bin/clang" ]; then | | 907 | if [ -n "$CLANGBASE" -o -f "/bin/clang" ]; then |
902 | echo "CLANGBASE= $CLANGBASE" >> ${TARGET_MKCONF} | | 908 | echo "CLANGBASE= $CLANGBASE" >> ${TARGET_MKCONF} |
903 | fi | | 909 | fi |
904 | ;; | | 910 | ;; |
905 | esac | | 911 | esac |
906 | if [ -n "$GCCBASE" ]; then | | 912 | if [ -n "$GCCBASE" ]; then |
907 | echo "GCCBASE= $GCCBASE" >> ${TARGET_MKCONF} | | 913 | echo "GCCBASE= $GCCBASE" >> ${TARGET_MKCONF} |
908 | fi | | 914 | fi |
909 | if [ -n "$SUNWSPROBASE" ]; then | | 915 | if [ -n "$SUNWSPROBASE" ]; then |
910 | echo "SUNWSPROBASE= $SUNWSPROBASE" >> ${TARGET_MKCONF} | | 916 | echo "SUNWSPROBASE= $SUNWSPROBASE" >> ${TARGET_MKCONF} |
911 | fi | | 917 | fi |
912 | echo "" >> ${TARGET_MKCONF} | | 918 | echo "" >> ${TARGET_MKCONF} |
913 | | | 919 | |
914 | # enable unprivileged builds if not root | | 920 | # enable unprivileged builds if not root |
915 | if [ "$unprivileged" = "yes" ]; then | | 921 | if [ "$unprivileged" = "yes" ]; then |
916 | echo "UNPRIVILEGED= yes" >> ${TARGET_MKCONF} | | 922 | echo "UNPRIVILEGED= yes" >> ${TARGET_MKCONF} |
917 | fi | | 923 | fi |
918 | | | 924 | |
919 | # save environment in example mk.conf | | 925 | # save environment in example mk.conf |
920 | echo "PKG_DBDIR= $pkgdbdir" >> ${TARGET_MKCONF} | | 926 | echo "PKG_DBDIR= $pkgdbdir" >> ${TARGET_MKCONF} |
921 | echo "LOCALBASE= $prefix" >> ${TARGET_MKCONF} | | 927 | echo "LOCALBASE= $prefix" >> ${TARGET_MKCONF} |
922 | echo "VARBASE= $varbase" >> ${TARGET_MKCONF} | | 928 | echo "VARBASE= $varbase" >> ${TARGET_MKCONF} |
923 | if [ "${sysconfdir}" != "${prefix}/etc" ]; then | | 929 | if [ "${sysconfdir}" != "${prefix}/etc" ]; then |
924 | echo "PKG_SYSCONFBASE= $sysconfdir" >> ${TARGET_MKCONF} | | 930 | echo "PKG_SYSCONFBASE= $sysconfdir" >> ${TARGET_MKCONF} |
925 | fi | | 931 | fi |
926 | echo "PKG_TOOLS_BIN= $prefix/sbin" >> ${TARGET_MKCONF} | | 932 | echo "PKG_TOOLS_BIN= $prefix/sbin" >> ${TARGET_MKCONF} |
927 | echo "PKGMANDIR= $pkgmandir" >> ${TARGET_MKCONF} | | 933 | echo "PKGMANDIR= $pkgmandir" >> ${TARGET_MKCONF} |
928 | echo "" >> ${TARGET_MKCONF} | | 934 | echo "" >> ${TARGET_MKCONF} |
929 | | | 935 | |
930 | if [ -n "$prefer_pkgsrc" ]; then | | 936 | if [ -n "$prefer_pkgsrc" ]; then |
931 | echo "PREFER_PKGSRC= $prefer_pkgsrc" >> ${TARGET_MKCONF} | | 937 | echo "PREFER_PKGSRC= $prefer_pkgsrc" >> ${TARGET_MKCONF} |
932 | echo "" >> ${TARGET_MKCONF} | | 938 | echo "" >> ${TARGET_MKCONF} |
933 | fi | | 939 | fi |
934 | | | 940 | |
935 | BOOTSTRAP_MKCONF=${wrkdir}/mk.conf | | 941 | BOOTSTRAP_MKCONF=${wrkdir}/mk.conf |
936 | cp ${TARGET_MKCONF} ${BOOTSTRAP_MKCONF} | | 942 | cp ${TARGET_MKCONF} ${BOOTSTRAP_MKCONF} |
937 | | | 943 | |
938 | # sbin is used by pkg_install, share/mk by bootstrap-mk-files | | 944 | # sbin is used by pkg_install, share/mk by bootstrap-mk-files |
939 | mkdir_p $wrkdir/sbin $wrkdir/share/mk | | 945 | mkdir_p $wrkdir/sbin $wrkdir/share/mk |
940 | mkdir_p_early ${wrkdir} | | 946 | mkdir_p_early ${wrkdir} |
941 | | | 947 | |
942 | if [ "$need_bsd_install" = "yes" ]; then | | 948 | if [ "$need_bsd_install" = "yes" ]; then |
943 | BSTRAP_ENV="INSTALL='$prefix/bin/install-sh -c' $BSTRAP_ENV" | | 949 | BSTRAP_ENV="INSTALL='$prefix/bin/install-sh -c' $BSTRAP_ENV" |
944 | echo "TOOLS_PLATFORM.install?= $prefix/bin/install-sh" >> ${TARGET_MKCONF} | | 950 | echo "TOOLS_PLATFORM.install?= $prefix/bin/install-sh" >> ${TARGET_MKCONF} |
945 | echo "TOOLS_PLATFORM.install?= $wrkdir/bin/install-sh" >> ${BOOTSTRAP_MKCONF} | | 951 | echo "TOOLS_PLATFORM.install?= $wrkdir/bin/install-sh" >> ${BOOTSTRAP_MKCONF} |
946 | fi | | 952 | fi |
947 | | | 953 | |
948 | if [ "$need_fixed_strip" = "yes" ] ; then | | 954 | if [ "$need_fixed_strip" = "yes" ] ; then |
949 | echo_msg "Installing fixed strip script" | | 955 | echo_msg "Installing fixed strip script" |
950 | run_cmd "$install_sh -c -o $user -g $group -m 755 $pkgsrcdir/pkgtools/bootstrap-extras/files/strip-sh $wrkdir/bin/strip" | | 956 | run_cmd "$install_sh -c -o $user -g $group -m 755 $pkgsrcdir/pkgtools/bootstrap-extras/files/strip-sh $wrkdir/bin/strip" |
951 | echo "TOOLS_PLATFORM.strip?= $prefix/bin/strip" >> ${TARGET_MKCONF} | | 957 | echo "TOOLS_PLATFORM.strip?= $prefix/bin/strip" >> ${TARGET_MKCONF} |
952 | echo "TOOLS_PLATFORM.strip?= $wrkdir/bin/strip" >> ${BOOTSTRAP_MKCONF} | | 958 | echo "TOOLS_PLATFORM.strip?= $wrkdir/bin/strip" >> ${BOOTSTRAP_MKCONF} |
953 | need_extras=yes | | 959 | need_extras=yes |
954 | fi | | 960 | fi |
955 | | | 961 | |
956 | if [ "$need_mkdir" = "yes" -a -z "$MKDIR" ]; then | | 962 | if [ "$need_mkdir" = "yes" -a -z "$MKDIR" ]; then |
957 | echo_msg "Installing fixed mkdir script \"mkdir-sh\"" | | 963 | echo_msg "Installing fixed mkdir script \"mkdir-sh\"" |
958 | run_cmd "$install_sh -c -o $user -g $group -m 755 $pkgsrcdir/pkgtools/bootstrap-extras/files/mkdir-sh $wrkdir/bin/mkdir-sh" | | 964 | run_cmd "$install_sh -c -o $user -g $group -m 755 $pkgsrcdir/pkgtools/bootstrap-extras/files/mkdir-sh $wrkdir/bin/mkdir-sh" |
959 | echo "TOOLS_PLATFORM.mkdir?= $prefix/bin/mkdir-sh -p" >> ${TARGET_MKCONF} | | 965 | echo "TOOLS_PLATFORM.mkdir?= $prefix/bin/mkdir-sh -p" >> ${TARGET_MKCONF} |
960 | echo "TOOLS_PLATFORM.mkdir?= $wrkdir/bin/mkdir-sh -p" >> ${BOOTSTRAP_MKCONF} | | 966 | echo "TOOLS_PLATFORM.mkdir?= $wrkdir/bin/mkdir-sh -p" >> ${BOOTSTRAP_MKCONF} |
961 | need_extras=yes | | 967 | need_extras=yes |
962 | fi | | 968 | fi |
963 | | | 969 | |
964 | if [ "$need_xargs" = "yes" ]; then | | 970 | if [ "$need_xargs" = "yes" ]; then |
965 | echo_msg "Installing fixed xargs script" | | 971 | echo_msg "Installing fixed xargs script" |
966 | run_cmd "$install_sh -c -o $user -g $group -m 755 $pkgsrcdir/pkgtools/bootstrap-extras/files/xargs-sh $wrkdir/bin/xargs" | | 972 | run_cmd "$install_sh -c -o $user -g $group -m 755 $pkgsrcdir/pkgtools/bootstrap-extras/files/xargs-sh $wrkdir/bin/xargs" |
967 | echo "TOOLS_PLATFORM.xargs?= $prefix/bin/xargs" >> ${TARGET_MKCONF} | | 973 | echo "TOOLS_PLATFORM.xargs?= $prefix/bin/xargs" >> ${TARGET_MKCONF} |
968 | echo "TOOLS_PLATFORM.xargs?= $wrkdir/bin/xargs" >> ${BOOTSTRAP_MKCONF} | | 974 | echo "TOOLS_PLATFORM.xargs?= $wrkdir/bin/xargs" >> ${BOOTSTRAP_MKCONF} |
969 | need_extras=yes | | 975 | need_extras=yes |
970 | fi | | 976 | fi |
971 | | | 977 | |
972 | echo_msg "Bootstrapping mk-files" | | 978 | echo_msg "Bootstrapping mk-files" |
973 | run_cmd "(cd ${pkgsrcdir}/pkgtools/bootstrap-mk-files/files && env CP=${cpprog} \ | | 979 | run_cmd "(cd ${pkgsrcdir}/pkgtools/bootstrap-mk-files/files && env CP=${cpprog} \ |
974 | OPSYS=${opsys} MK_DST=${wrkdir}/share/mk ROOT_GROUP=${root_group} \ | | 980 | OPSYS=${opsys} MK_DST=${wrkdir}/share/mk ROOT_GROUP=${root_group} \ |
975 | ROOT_USER=${root_user} SED=${sedprog} SYSCONFDIR=${sysconfdir} \ | | 981 | ROOT_USER=${root_user} SED=${sedprog} SYSCONFDIR=${sysconfdir} \ |
976 | $shprog ./bootstrap.sh)" | | 982 | $shprog ./bootstrap.sh)" |
977 | | | 983 | |
978 | bootstrap_bmake() { | | 984 | bootstrap_bmake() { |
979 | echo_msg "Bootstrapping bmake" | | 985 | echo_msg "Bootstrapping bmake" |
980 | copy_src $pkgsrcdir/devel/bmake/files bmake | | 986 | copy_src $pkgsrcdir/devel/bmake/files bmake |
981 | run_cmd "(cd $wrkdir/bmake && env $bmakexenv $shprog ./boot-strap $configure_quiet_flags -q -o bootstrap.$opsys --prefix=$wrkdir --sysconfdir=$wrkdir --mksrc none --with-default-sys-path="$wrkdir/share/mk" $bmakexargs)" | | 987 | run_cmd "(cd $wrkdir/bmake && env $bmakexenv $shprog ./boot-strap $configure_quiet_flags -q -o bootstrap.$opsys --prefix=$wrkdir --sysconfdir=$wrkdir --mksrc none --with-default-sys-path="$wrkdir/share/mk" $bmakexargs)" |
982 | run_cmd "$install_sh -c -o $user -g $group -m 755 $wrkdir/bmake/bootstrap.$opsys/bmake $wrkdir/bin/bmake" | | 988 | run_cmd "$install_sh -c -o $user -g $group -m 755 $wrkdir/bmake/bootstrap.$opsys/bmake $wrkdir/bin/bmake" |
983 | } | | 989 | } |
984 | bootstrap_bmake | | 990 | bootstrap_bmake |
985 | | | 991 | |
986 | bmake="$wrkdir/bin/bmake $make_quiet_flags" | | 992 | bmake="$wrkdir/bin/bmake $make_quiet_flags" |
987 | | | 993 | |
988 | # build libnbcompat | | 994 | # build libnbcompat |
989 | echo_msg "Building libnbcompat" | | 995 | echo_msg "Building libnbcompat" |
990 | copy_src $pkgsrcdir/pkgtools/libnbcompat/files libnbcompat | | 996 | copy_src $pkgsrcdir/pkgtools/libnbcompat/files libnbcompat |
991 | 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)" | | 997 | 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)" |
992 | | | 998 | |
993 | # bootstrap ksh if necessary | | 999 | # bootstrap ksh if necessary |
994 | case "$need_ksh" in | | 1000 | case "$need_ksh" in |
995 | yes) echo_msg "Bootstrapping ksh" | | 1001 | yes) echo_msg "Bootstrapping ksh" |
996 | copy_src $pkgsrcdir/shells/pdksh/files ksh | | 1002 | copy_src $pkgsrcdir/shells/pdksh/files ksh |
997 | test -n "$CC" || CC=gcc # default to gcc if no compiler is specified | | 1003 | test -n "$CC" || CC=gcc # default to gcc if no compiler is specified |
998 | run_cmd "(cd $wrkdir/ksh && env $BSTRAP_ENV $shprog ./configure $configure_quiet_flags --prefix=$prefix --mandir=$mandir --sysconfdir=$sysconfdir && $bmake)" | | 1004 | run_cmd "(cd $wrkdir/ksh && env $BSTRAP_ENV $shprog ./configure $configure_quiet_flags --prefix=$prefix --mandir=$mandir --sysconfdir=$sysconfdir && $bmake)" |
999 | run_cmd "$install_sh -c -o $user -g $group -m 755 $wrkdir/ksh/ksh $wrkdir/bin/pdksh" | | 1005 | run_cmd "$install_sh -c -o $user -g $group -m 755 $wrkdir/ksh/ksh $wrkdir/bin/pdksh" |
1000 | echo "TOOLS_PLATFORM.sh?= $prefix/bin/pdksh" >> ${TARGET_MKCONF} | | 1006 | echo "TOOLS_PLATFORM.sh?= $prefix/bin/pdksh" >> ${TARGET_MKCONF} |
1001 | echo "TOOLS_PLATFORM.sh?= $wrkdir/bin/pdksh" >> ${BOOTSTRAP_MKCONF} | | 1007 | echo "TOOLS_PLATFORM.sh?= $wrkdir/bin/pdksh" >> ${BOOTSTRAP_MKCONF} |
1002 | echo "TOOLS_PLATFORM.ksh?= $prefix/bin/pdksh" >> ${TARGET_MKCONF} | | 1008 | echo "TOOLS_PLATFORM.ksh?= $prefix/bin/pdksh" >> ${TARGET_MKCONF} |
1003 | echo "TOOLS_PLATFORM.ksh?= $wrkdir/bin/pdksh" >> ${BOOTSTRAP_MKCONF} | | 1009 | echo "TOOLS_PLATFORM.ksh?= $wrkdir/bin/pdksh" >> ${BOOTSTRAP_MKCONF} |
1004 | # Now rebootstrap bmake for ksh | | 1010 | # Now rebootstrap bmake for ksh |
1005 | echo_msg "Rebootstrapping bmake for ksh" | | 1011 | echo_msg "Rebootstrapping bmake for ksh" |
1006 | bmakexargs="$bmakexargs --with-defshell=$wrkdir/bin/pdksh" | | 1012 | bmakexargs="$bmakexargs --with-defshell=$wrkdir/bin/pdksh" |
1007 | bootstrap_bmake | | 1013 | bootstrap_bmake |
1008 | ;; | | 1014 | ;; |
1009 | esac | | 1015 | esac |
1010 | | | 1016 | |
1011 | # bootstrap awk if necessary | | 1017 | # bootstrap awk if necessary |
1012 | case "$need_awk" in | | 1018 | case "$need_awk" in |
1013 | yes) echo_msg "Bootstrapping awk" | | 1019 | yes) echo_msg "Bootstrapping awk" |
1014 | copy_src $pkgsrcdir/lang/nawk/files awk | | 1020 | copy_src $pkgsrcdir/lang/nawk/files awk |
1015 | test -n "$CC" || CC=gcc # default to gcc if no compiler is specified | | 1021 | test -n "$CC" || CC=gcc # default to gcc if no compiler is specified |
1016 | run_cmd "(cd $wrkdir/awk && $bmake -f Makefile CC=\"${CC}\" CFLAGS=\"${CFLAGS}\")" | | 1022 | run_cmd "(cd $wrkdir/awk && $bmake -f Makefile CC=\"${CC}\" CFLAGS=\"${CFLAGS}\")" |
1017 | run_cmd "$install_sh -c -o $user -g $group -m 755 $wrkdir/awk/a.out $wrkdir/bin/nawk" | | 1023 | run_cmd "$install_sh -c -o $user -g $group -m 755 $wrkdir/awk/a.out $wrkdir/bin/nawk" |
1018 | echo "TOOLS_PLATFORM.awk?= $prefix/bin/nawk" >> ${TARGET_MKCONF} | | 1024 | echo "TOOLS_PLATFORM.awk?= $prefix/bin/nawk" >> ${TARGET_MKCONF} |
1019 | echo "TOOLS_PLATFORM.awk?= $wrkdir/bin/nawk" >> ${BOOTSTRAP_MKCONF} | | 1025 | echo "TOOLS_PLATFORM.awk?= $wrkdir/bin/nawk" >> ${BOOTSTRAP_MKCONF} |
1020 | ;; | | 1026 | ;; |
1021 | esac | | 1027 | esac |
1022 | | | 1028 | |
1023 | # bootstrap sed if necessary | | 1029 | # bootstrap sed if necessary |
1024 | case "$need_sed" in | | 1030 | case "$need_sed" in |
1025 | yes) echo_msg "Bootstrapping sed" | | 1031 | yes) echo_msg "Bootstrapping sed" |
1026 | copy_src $pkgsrcdir/textproc/nbsed/files sed | | 1032 | copy_src $pkgsrcdir/textproc/nbsed/files sed |
1027 | 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)" | | 1033 | 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)" |
1028 | run_cmd "$install_sh -c -o $user -g $group -m 755 $wrkdir/sed/sed $wrkdir/bin/sed" | | 1034 | run_cmd "$install_sh -c -o $user -g $group -m 755 $wrkdir/sed/sed $wrkdir/bin/sed" |
1029 | echo "TOOLS_PLATFORM.sed?= $prefix/bin/nbsed" >> ${TARGET_MKCONF} | | 1035 | echo "TOOLS_PLATFORM.sed?= $prefix/bin/nbsed" >> ${TARGET_MKCONF} |
1030 | echo "TOOLS_PLATFORM.sed?= $wrkdir/bin/sed" >> ${BOOTSTRAP_MKCONF} | | 1036 | echo "TOOLS_PLATFORM.sed?= $wrkdir/bin/sed" >> ${BOOTSTRAP_MKCONF} |
1031 | ;; | | 1037 | ;; |
1032 | esac | | 1038 | esac |
1033 | | | 1039 | |
1034 | # bootstrap pkg_install | | 1040 | # bootstrap pkg_install |
1035 | echo_msg "Bootstrapping pkgtools" | | 1041 | echo_msg "Bootstrapping pkgtools" |
1036 | copy_src $pkgsrcdir/pkgtools/pkg_install/files pkg_install | | 1042 | copy_src $pkgsrcdir/pkgtools/pkg_install/files pkg_install |
1037 | run_cmd "(cd $wrkdir/pkg_install; env $BSTRAP_ENV \ | | 1043 | run_cmd "(cd $wrkdir/pkg_install; env $BSTRAP_ENV \ |
1038 | CPPFLAGS='$CPPFLAGS -I../libnbcompat -I../../libnbcompat' \ | | 1044 | CPPFLAGS='$CPPFLAGS -I../libnbcompat -I../../libnbcompat' \ |
1039 | LDFLAGS='$LDFLAGS -L../libnbcompat -L../../libnbcompat' \ | | 1045 | LDFLAGS='$LDFLAGS -L../libnbcompat -L../../libnbcompat' \ |
1040 | LIBS='$LIBS -lnbcompat' $shprog ./configure $configure_quiet_flags -C \ | | 1046 | LIBS='$LIBS -lnbcompat' $shprog ./configure $configure_quiet_flags -C \ |
1041 | --enable-bootstrap --prefix=$prefix --sysconfdir=$sysconfdir \ | | 1047 | --enable-bootstrap --prefix=$prefix --sysconfdir=$sysconfdir \ |
1042 | --with-pkgdbdir=$pkgdbdir --mandir=$mandir $pkg_install_args && $bmake)" | | 1048 | --with-pkgdbdir=$pkgdbdir --mandir=$mandir $pkg_install_args && $bmake)" |
1043 | run_cmd "$install_sh -c -o $user -g $group -m 755 $wrkdir/pkg_install/admin/pkg_admin $wrkdir/sbin/pkg_admin" | | 1049 | run_cmd "$install_sh -c -o $user -g $group -m 755 $wrkdir/pkg_install/admin/pkg_admin $wrkdir/sbin/pkg_admin" |
1044 | run_cmd "$install_sh -c -o $user -g $group -m 755 $wrkdir/pkg_install/create/pkg_create $wrkdir/sbin/pkg_create" | | 1050 | run_cmd "$install_sh -c -o $user -g $group -m 755 $wrkdir/pkg_install/create/pkg_create $wrkdir/sbin/pkg_create" |
1045 | run_cmd "$install_sh -c -o $user -g $group -m 755 $wrkdir/pkg_install/info/pkg_info $wrkdir/sbin/pkg_info" | | 1051 | run_cmd "$install_sh -c -o $user -g $group -m 755 $wrkdir/pkg_install/info/pkg_info $wrkdir/sbin/pkg_info" |
1046 | echo "PKG_ADMIN_CMD?= $wrkdir/sbin/pkg_admin" >> ${BOOTSTRAP_MKCONF} | | 1052 | echo "PKG_ADMIN_CMD?= $wrkdir/sbin/pkg_admin" >> ${BOOTSTRAP_MKCONF} |
1047 | echo "PKG_CREATE_CMD?= $wrkdir/sbin/pkg_create" >> ${BOOTSTRAP_MKCONF} | | 1053 | echo "PKG_CREATE_CMD?= $wrkdir/sbin/pkg_create" >> ${BOOTSTRAP_MKCONF} |
1048 | echo "PKG_INFO_CMD?= $wrkdir/sbin/pkg_info" >> ${BOOTSTRAP_MKCONF} | | 1054 | echo "PKG_INFO_CMD?= $wrkdir/sbin/pkg_info" >> ${BOOTSTRAP_MKCONF} |
1049 | | | 1055 | |
1050 | MAKECONF=$wrkdir/mk.conf | | 1056 | MAKECONF=$wrkdir/mk.conf |
1051 | export MAKECONF | | 1057 | export MAKECONF |
1052 | | | 1058 | |
1053 | if [ "$bootstrap_sh_set" = "set" ]; then | | 1059 | if [ "$bootstrap_sh_set" = "set" ]; then |
1054 | echo "TOOLS_PLATFORM.sh?= ${bootstrap_sh}" >> ${TARGET_MKCONF} | | 1060 | echo "TOOLS_PLATFORM.sh?= ${bootstrap_sh}" >> ${TARGET_MKCONF} |
1055 | echo "TOOLS_PLATFORM.sh?= ${bootstrap_sh}" >> ${BOOTSTRAP_MKCONF} | | 1061 | echo "TOOLS_PLATFORM.sh?= ${bootstrap_sh}" >> ${BOOTSTRAP_MKCONF} |
1056 | fi | | 1062 | fi |
1057 | | | 1063 | |
1058 | # preserve compiler and tool environment variables settings | | 1064 | # preserve compiler and tool environment variables settings |
1059 | if test -n "$CP"; then | | 1065 | if test -n "$CP"; then |
1060 | echo "TOOLS_PLATFORM.cp?= $CP" >> ${TARGET_MKCONF} | | 1066 | echo "TOOLS_PLATFORM.cp?= $CP" >> ${TARGET_MKCONF} |
1061 | echo "TOOLS_PLATFORM.cp?= $CP" >> ${BOOTSTRAP_MKCONF} | | 1067 | echo "TOOLS_PLATFORM.cp?= $CP" >> ${BOOTSTRAP_MKCONF} |
1062 | fi | | 1068 | fi |
1063 | if test -n "$GREP"; then | | 1069 | if test -n "$GREP"; then |
1064 | echo "TOOLS_PLATFORM.grep?= $GREP" >> ${TARGET_MKCONF} | | 1070 | echo "TOOLS_PLATFORM.grep?= $GREP" >> ${TARGET_MKCONF} |
1065 | echo "TOOLS_PLATFORM.grep?= $GREP" >> ${BOOTSTRAP_MKCONF} | | 1071 | echo "TOOLS_PLATFORM.grep?= $GREP" >> ${BOOTSTRAP_MKCONF} |
1066 | fi | | 1072 | fi |
1067 | if test -n "$ID"; then | | 1073 | if test -n "$ID"; then |
1068 | echo "TOOLS_PLATFORM.id?= $ID" >> ${TARGET_MKCONF} | | 1074 | echo "TOOLS_PLATFORM.id?= $ID" >> ${TARGET_MKCONF} |
1069 | echo "TOOLS_PLATFORM.id?= $ID" >> ${BOOTSTRAP_MKCONF} | | 1075 | echo "TOOLS_PLATFORM.id?= $ID" >> ${BOOTSTRAP_MKCONF} |
1070 | fi | | 1076 | fi |
1071 | if test -n "$MKDIR"; then | | 1077 | if test -n "$MKDIR"; then |
1072 | echo "TOOLS_PLATFORM.mkdir?= $MKDIR" >> ${TARGET_MKCONF} | | 1078 | echo "TOOLS_PLATFORM.mkdir?= $MKDIR" >> ${TARGET_MKCONF} |
1073 | echo "TOOLS_PLATFORM.mkdir?= $MKDIR" >> ${BOOTSTRAP_MKCONF} | | 1079 | echo "TOOLS_PLATFORM.mkdir?= $MKDIR" >> ${BOOTSTRAP_MKCONF} |
1074 | fi | | 1080 | fi |
1075 | if test -n "$TEST"; then | | 1081 | if test -n "$TEST"; then |
1076 | echo "TOOLS_PLATFORM.test?= $TEST" >> ${TARGET_MKCONF} | | 1082 | echo "TOOLS_PLATFORM.test?= $TEST" >> ${TARGET_MKCONF} |
1077 | echo "TOOLS_PLATFORM.test?= $TEST" >> ${BOOTSTRAP_MKCONF} | | 1083 | echo "TOOLS_PLATFORM.test?= $TEST" >> ${BOOTSTRAP_MKCONF} |
1078 | fi | | 1084 | fi |
1079 | if test -n "$TOUCH"; then | | 1085 | if test -n "$TOUCH"; then |
1080 | echo "TOOLS_PLATFORM.touch?= $TOUCH" >> ${TARGET_MKCONF} | | 1086 | echo "TOOLS_PLATFORM.touch?= $TOUCH" >> ${TARGET_MKCONF} |
1081 | echo "TOOLS_PLATFORM.touch?= $TOUCH" >> ${BOOTSTRAP_MKCONF} | | 1087 | echo "TOOLS_PLATFORM.touch?= $TOUCH" >> ${BOOTSTRAP_MKCONF} |
1082 | fi | | 1088 | fi |
1083 | if test -n "$XARGS"; then | | 1089 | if test -n "$XARGS"; then |
1084 | echo "TOOLS_PLATFORM.xargs?= $XARGS" >> ${TARGET_MKCONF} | | 1090 | echo "TOOLS_PLATFORM.xargs?= $XARGS" >> ${TARGET_MKCONF} |
1085 | echo "TOOLS_PLATFORM.xargs?= $XARGS" >> ${BOOTSTRAP_MKCONF} | | 1091 | echo "TOOLS_PLATFORM.xargs?= $XARGS" >> ${BOOTSTRAP_MKCONF} |
1086 | fi | | 1092 | fi |
1087 | if test -n "$CFLAGS"; then | | 1093 | if test -n "$CFLAGS"; then |
1088 | echo "CFLAGS+= $CFLAGS" >> ${TARGET_MKCONF} | | 1094 | echo "CFLAGS+= $CFLAGS" >> ${TARGET_MKCONF} |
1089 | echo "DBG= # prevent DBG from adding default optimizer flags" >> ${TARGET_MKCONF} | | 1095 | echo "DBG= # prevent DBG from adding default optimizer flags" >> ${TARGET_MKCONF} |
1090 | echo "DBG= # prevent DBG from adding default optimizer flags" >> ${BOOTSTRAP_MKCONF} | | 1096 | echo "DBG= # prevent DBG from adding default optimizer flags" >> ${BOOTSTRAP_MKCONF} |
1091 | fi | | 1097 | fi |
1092 | if test -n "$CPPFLAGS"; then | | 1098 | if test -n "$CPPFLAGS"; then |
1093 | echo "CPPFLAGS+= $CPPFLAGS" >> ${TARGET_MKCONF} | | 1099 | echo "CPPFLAGS+= $CPPFLAGS" >> ${TARGET_MKCONF} |
1094 | fi | | 1100 | fi |
1095 | if test -n "$LDFLAGS"; then | | 1101 | if test -n "$LDFLAGS"; then |
1096 | echo "LDFLAGS+= $LDFLAGS" >> ${TARGET_MKCONF} | | 1102 | echo "LDFLAGS+= $LDFLAGS" >> ${TARGET_MKCONF} |
1097 | fi | | 1103 | fi |
1098 | if test -n "$LIBS"; then | | 1104 | if test -n "$LIBS"; then |
1099 | echo "LIBS+= $LIBS" >> ${TARGET_MKCONF} | | 1105 | echo "LIBS+= $LIBS" >> ${TARGET_MKCONF} |
1100 | fi | | 1106 | fi |
1101 | | | 1107 | |
1102 | # opsys specific fiddling | | 1108 | # opsys specific fiddling |
1103 | opsys_finish | | 1109 | opsys_finish |
1104 | | | 1110 | |
1105 | echo "WRKOBJDIR= ${wrkdir}/wrk" >> ${BOOTSTRAP_MKCONF} | | 1111 | echo "WRKOBJDIR= ${wrkdir}/wrk" >> ${BOOTSTRAP_MKCONF} |
1106 | | | 1112 | |
1107 | echo "" >> ${TARGET_MKCONF} | | 1113 | echo "" >> ${TARGET_MKCONF} |
1108 | echo "" >> ${BOOTSTRAP_MKCONF} | | 1114 | echo "" >> ${BOOTSTRAP_MKCONF} |
1109 | if test -n "${mk_fragment}"; then | | 1115 | if test -n "${mk_fragment}"; then |
1110 | cat "${mk_fragment}" >> ${TARGET_MKCONF} | | 1116 | cat "${mk_fragment}" >> ${TARGET_MKCONF} |
1111 | echo "" >> ${TARGET_MKCONF} | | 1117 | echo "" >> ${TARGET_MKCONF} |
1112 | fi | | 1118 | fi |
1113 | echo ".endif # end pkgsrc settings" >> ${TARGET_MKCONF} | | 1119 | echo ".endif # end pkgsrc settings" >> ${TARGET_MKCONF} |
1114 | echo ".endif # end pkgsrc settings" >> ${BOOTSTRAP_MKCONF} | | 1120 | echo ".endif # end pkgsrc settings" >> ${BOOTSTRAP_MKCONF} |
1115 | | | 1121 | |
1116 | # register packages | | 1122 | # register packages |
1117 | # usage: register_package <packagedirectory> [additional arguments] | | 1123 | # usage: register_package <packagedirectory> [additional arguments] |
1118 | build_package() { | | 1124 | build_package() { |
1119 | run_cmd "(cd $pkgsrcdir/$1 && $bmake USE_DESTDIR=no -DPKG_PRESERVE MAKECONF=${BOOTSTRAP_MKCONF} install)" | | 1125 | run_cmd "(cd $pkgsrcdir/$1 && $bmake USE_DESTDIR=no -DPKG_PRESERVE MAKECONF=${BOOTSTRAP_MKCONF} install)" |
1120 | } | | 1126 | } |
1121 | | | 1127 | |
1122 | # | | 1128 | # |
1123 | # Please make sure that the following packages and | | 1129 | # Please make sure that the following packages and |
1124 | # only the following packages set BOOTSTRAP_PKG=yes. | | 1130 | # only the following packages set BOOTSTRAP_PKG=yes. |
1125 | # | | 1131 | # |
1126 | echo_msg "Installing packages" | | 1132 | echo_msg "Installing packages" |
1127 | build_package "pkgtools/bootstrap-mk-files" | | 1133 | build_package "pkgtools/bootstrap-mk-files" |
1128 | case "$need_bsd_install" in | | 1134 | case "$need_bsd_install" in |
1129 | yes) build_package "sysutils/install-sh";; | | 1135 | yes) build_package "sysutils/install-sh";; |
1130 | esac | | 1136 | esac |
1131 | case "$need_ksh" in | | 1137 | case "$need_ksh" in |
1132 | yes) build_package "shells/pdksh";; | | 1138 | yes) build_package "shells/pdksh";; |
1133 | esac | | 1139 | esac |
1134 | build_package "devel/bmake" | | 1140 | build_package "devel/bmake" |
1135 | case "$need_awk" in | | 1141 | case "$need_awk" in |
1136 | yes) build_package "lang/nawk";; | | 1142 | yes) build_package "lang/nawk";; |
1137 | esac | | 1143 | esac |
1138 | case "$need_sed" in | | 1144 | case "$need_sed" in |
1139 | yes) build_package "textproc/nbsed";; | | 1145 | yes) build_package "textproc/nbsed";; |
1140 | esac | | 1146 | esac |
1141 | case "$need_extras" in | | 1147 | case "$need_extras" in |
1142 | yes) build_package "pkgtools/bootstrap-extras";; | | 1148 | yes) build_package "pkgtools/bootstrap-extras";; |
1143 | esac | | 1149 | esac |
1144 | build_package "pkgtools/pkg_install" | | 1150 | build_package "pkgtools/pkg_install" |
1145 | | | 1151 | |
1146 | etc_mk_conf="$sysconfdir/mk.conf" | | 1152 | etc_mk_conf="$sysconfdir/mk.conf" |
1147 | | | 1153 | |
1148 | # Install the example mk.conf so that it is used, but only if it doesn't | | 1154 | # Install the example mk.conf so that it is used, but only if it doesn't |
1149 | # exist yet. This can happen with non-default sysconfdir settings. | | 1155 | # exist yet. This can happen with non-default sysconfdir settings. |
1150 | mkdir_p "$sysconfdir" | | 1156 | mkdir_p "$sysconfdir" |
1151 | if [ ! -f "$etc_mk_conf" ]; then | | 1157 | if [ ! -f "$etc_mk_conf" ]; then |
1152 | cp "$TARGET_MKCONF" "$etc_mk_conf" | | 1158 | cp "$TARGET_MKCONF" "$etc_mk_conf" |
1153 | TARGET_MKCONF="$etc_mk_conf" | | 1159 | TARGET_MKCONF="$etc_mk_conf" |
1154 | fi | | 1160 | fi |
1155 | | | 1161 | |
1156 | hline="===========================================================================" | | 1162 | hline="===========================================================================" |
1157 | echo "" | | 1163 | echo "" |
1158 | echo "$hline" | | 1164 | echo "$hline" |
1159 | echo "" | | 1165 | echo "" |
1160 | echo "Please remember to add $prefix/bin to your PATH environment variable" | | 1166 | echo "Please remember to add $prefix/bin to your PATH environment variable" |
1161 | echo "and $mandir to your MANPATH environment variable, if necessary." | | 1167 | echo "and $mandir to your MANPATH environment variable, if necessary." |
1162 | echo "" | | 1168 | echo "" |
1163 | echo "An example mk.conf file with the settings you provided to \"bootstrap\"" | | 1169 | echo "An example mk.conf file with the settings you provided to \"bootstrap\"" |
1164 | echo "has been created for you. It can be found in:" | | 1170 | echo "has been created for you. It can be found in:" |
1165 | echo "" | | 1171 | echo "" |
1166 | echo " ${TARGET_MKCONF}" | | 1172 | echo " ${TARGET_MKCONF}" |
1167 | echo "" | | 1173 | echo "" |
1168 | if [ "$TARGET_MKCONF" != "$etc_mk_conf" ]; then | | 1174 | if [ "$TARGET_MKCONF" != "$etc_mk_conf" ]; then |
1169 | echo "Please copy it to $etc_mk_conf to use it." | | 1175 | echo "Please copy it to $etc_mk_conf to use it." |
1170 | echo "" | | 1176 | echo "" |
1171 | fi | | 1177 | fi |
1172 | echo "You can find extensive documentation of the NetBSD Packages Collection" | | 1178 | echo "You can find extensive documentation of the NetBSD Packages Collection" |
1173 | echo "in $pkgsrcdir/doc/pkgsrc.txt." | | 1179 | echo "in $pkgsrcdir/doc/pkgsrc.txt." |
1174 | echo "" | | 1180 | echo "" |
1175 | echo "Hopefully everything is now complete." | | 1181 | echo "Hopefully everything is now complete." |
1176 | echo "Thank you for using pkgsrc!" | | 1182 | echo "Thank you for using pkgsrc!" |
1177 | echo "" | | 1183 | echo "" |
1178 | echo "$hline" | | 1184 | echo "$hline" |
1179 | echo "" | | 1185 | echo "" |
1180 | | | 1186 | |
1181 | [ -n "${binary_kit}" ] && mkbinarykit_tar | | 1187 | [ -n "${binary_kit}" ] && mkbinarykit_tar |
1182 | [ -n "${binary_gzip_kit}" ] && mkbinarykit_tgz | | 1188 | [ -n "${binary_gzip_kit}" ] && mkbinarykit_tgz |
1183 | [ -n "${binary_macpkg}" ] && mkbinarykit_macpkg | | 1189 | [ -n "${binary_macpkg}" ] && mkbinarykit_macpkg |
1184 | | | 1190 | |
1185 | echo_msg "bootstrap started: $build_start" | | 1191 | echo_msg "bootstrap started: $build_start" |
1186 | echo_msg "bootstrap ended: `date`" | | 1192 | echo_msg "bootstrap ended: `date`" |
1187 | | | 1193 | |
1188 | exit 0 | | 1194 | exit 0 |