| 1 | # $FreeWRT: src/share/misc/licence.template,v 1.20 2006/12/11 21:04:56 tg Rel $
|
|---|
| 2 | #-
|
|---|
| 3 | # Copyright (c) 2006, 2007
|
|---|
| 4 | # Thorsten Glaser <tg@mirbsd.de>
|
|---|
| 5 | #
|
|---|
| 6 | # Provided that these terms and disclaimer and all copyright notices
|
|---|
| 7 | # are retained or reproduced in an accompanying document, permission
|
|---|
| 8 | # is granted to deal in this work without restriction, including un-
|
|---|
| 9 | # limited rights to use, publicly perform, distribute, sell, modify,
|
|---|
| 10 | # merge, give away, or sublicence.
|
|---|
| 11 | #
|
|---|
| 12 | # Advertising materials mentioning features or use of this work must
|
|---|
| 13 | # display the following acknowledgement:
|
|---|
| 14 | # This product includes material provided by Thorsten Glaser.
|
|---|
| 15 | # This acknowledgement does not need to be reprinted if this work is
|
|---|
| 16 | # linked into a bigger work whose licence does not allow such clause
|
|---|
| 17 | # and the author of this work is given due credit in the bigger work
|
|---|
| 18 | # or its accompanying documents, where such information is generally
|
|---|
| 19 | # kept, provided that said credits are retained.
|
|---|
| 20 | #
|
|---|
| 21 | # This work is provided "AS IS" and WITHOUT WARRANTY of any kind, to
|
|---|
| 22 | # the utmost extent permitted by applicable law, neither express nor
|
|---|
| 23 | # implied; without malicious intent or gross negligence. In no event
|
|---|
| 24 | # may a licensor, author or contributor be held liable for indirect,
|
|---|
| 25 | # direct, other damage, loss, or other issues arising in any way out
|
|---|
| 26 | # of dealing in the work, even if advised of the possibility of such
|
|---|
| 27 | # damage or existence of a defect, except proven that it results out
|
|---|
| 28 | # of said person's immediate fault when using the work as intended.
|
|---|
| 29 | #-
|
|---|
| 30 | # Scan for prerequisite host tools.
|
|---|
| 31 |
|
|---|
| 32 | if test -z "$BASH_VERSION"; then
|
|---|
| 33 | echo FreeWRT requires GNU bash to be installed, sorry.
|
|---|
| 34 | exit 1
|
|---|
| 35 | fi
|
|---|
| 36 |
|
|---|
| 37 | shopt -s extglob
|
|---|
| 38 | topdir=$(pwd)
|
|---|
| 39 | opath=$PATH
|
|---|
| 40 | out=0
|
|---|
| 41 | bmake=
|
|---|
| 42 |
|
|---|
| 43 | if [[ $NO_ERROR != @(0|1) ]]; then
|
|---|
| 44 | echo Please do not invoke this script directly!
|
|---|
| 45 | exit 1
|
|---|
| 46 | fi
|
|---|
| 47 |
|
|---|
| 48 | set -e
|
|---|
| 49 | rm -rf $topdir/lbin/tmp
|
|---|
| 50 | mkdir -p $topdir/lbin/tmp
|
|---|
| 51 | cd $topdir/lbin/tmp
|
|---|
| 52 |
|
|---|
| 53 | rm -f foo
|
|---|
| 54 | echo >FOO
|
|---|
| 55 | if [[ -e foo ]]; then
|
|---|
| 56 | cat >&2 <<-EOF
|
|---|
| 57 | ERROR: FreeWRT cannot be built in a case-insensitive
|
|---|
| 58 | file system. Please use scripts/darwindiskimage on a
|
|---|
| 59 | Macintosh to create a case-sensitive filesystem image,
|
|---|
| 60 | or reconfigure your Windows system approprately.
|
|---|
| 61 | EOF
|
|---|
| 62 | exit 1
|
|---|
| 63 | fi
|
|---|
| 64 | rm -f FOO
|
|---|
| 65 |
|
|---|
| 66 | os=$(uname)
|
|---|
| 67 | case $os in
|
|---|
| 68 | Darwin)
|
|---|
| 69 | # needs a bunch of quirks, but seems to compile
|
|---|
| 70 | echo Warning: Darwin support is highly experimental.
|
|---|
| 71 | echo
|
|---|
| 72 | ;;
|
|---|
| 73 | Linux)
|
|---|
| 74 | # supported with no extra quirks at the moment
|
|---|
| 75 | ;;
|
|---|
| 76 | MirBSD)
|
|---|
| 77 | # needs a little quirk, because the autoconf
|
|---|
| 78 | # version of some packages doesn't recognise
|
|---|
| 79 | # it as valid OS, and as build (not host) OS
|
|---|
| 80 | # faking OpenBSD is close enough
|
|---|
| 81 | rm -f $topdir/lbin/uname
|
|---|
| 82 | sed -e 's!@@FromOS@@!MirBSD!g' -e 's!@@ToOS@@!OpenBSD!g' \
|
|---|
| 83 | -e "s!@@PROG@@!$($topdir/lbin/which uname)!g" \
|
|---|
| 84 | <$topdir/scripts/uname.fake >$topdir/lbin/uname
|
|---|
| 85 | chmod 555 $topdir/lbin/uname
|
|---|
| 86 | bmake=/usr/bin/make
|
|---|
| 87 | ;;
|
|---|
| 88 | NetBSD)
|
|---|
| 89 | echo Warning: NetBSD® support is not completed.
|
|---|
| 90 | echo
|
|---|
| 91 | ;;
|
|---|
| 92 | OpenBSD)
|
|---|
| 93 | # supported with no extra quirks at the moment
|
|---|
| 94 | # although some packages' autoconf scripts may
|
|---|
| 95 | # not properly recognise OpenBSD
|
|---|
| 96 | ;;
|
|---|
| 97 | *)
|
|---|
| 98 | # unsupported
|
|---|
| 99 | echo "Building FreeWRT on $os is currently unsupported."
|
|---|
| 100 | echo "Sorry."
|
|---|
| 101 | echo
|
|---|
| 102 | case $os in
|
|---|
| 103 | Cyg*)
|
|---|
| 104 | echo "The most prominent issue is that filesystems"
|
|---|
| 105 | echo "can be case-insensitive. Some macros are missing."
|
|---|
| 106 | echo
|
|---|
| 107 | ;;
|
|---|
| 108 | NetBSD|FreeBSD|DragonFly)
|
|---|
| 109 | echo "Building should succeed with relatively few"
|
|---|
| 110 | echo "patches, but perl must live in /usr/bin for"
|
|---|
| 111 | echo "now in FreeWRT, which should indeed be fixed."
|
|---|
| 112 | echo
|
|---|
| 113 | ;;
|
|---|
| 114 | esac
|
|---|
| 115 | echo "If you need FreeWRT building on $os, please contact"
|
|---|
| 116 | echo "the development team; there may be contractors available"
|
|---|
| 117 | echo "for this task. If you intend on turning $os into one of"
|
|---|
| 118 | echo "the supported build OSes, please contact us as well so"
|
|---|
| 119 | echo "that we can feed back your enhancements into FreeWRT."
|
|---|
| 120 | exit 1
|
|---|
| 121 | ;;
|
|---|
| 122 | esac
|
|---|
| 123 |
|
|---|
| 124 | set +e
|
|---|
| 125 |
|
|---|
| 126 | if [[ ! -e $topdir/lbin/gmake ]]; then
|
|---|
| 127 | for f in $topdir/tools_build/gmake/make \
|
|---|
| 128 | "$($topdir/lbin/which gmake)" "$($topdir/lbin/which make)"; do
|
|---|
| 129 | [[ -e $f ]] || continue
|
|---|
| 130 | if [[ $f = $topdir/tools_build/gmake/make ]]; then
|
|---|
| 131 | install -c -s -m 555 $f $topdir/lbin/gmake
|
|---|
| 132 | else
|
|---|
| 133 | ln -s "$f" $topdir/lbin/gmake
|
|---|
| 134 | fi
|
|---|
| 135 | break
|
|---|
| 136 | done
|
|---|
| 137 | fi
|
|---|
| 138 | X=$($topdir/lbin/gmake --version 2>&1 | grep '^GNU Make' | \
|
|---|
| 139 | sed -e 's/GNU Make //' -e 's/version //' -e 's/, by.*$//')
|
|---|
| 140 | [[ $X = +([0-9]).+([0-9]).+([0-9]) ]] && X=${X%.*}
|
|---|
| 141 | if [[ $X = +([0-9]).+([0-9]) ]]; then
|
|---|
| 142 | let major=${X%.*}
|
|---|
| 143 | let minor=${X#*.}
|
|---|
| 144 | elif [[ $X = +([0-9]).+([0-9])beta* ]]; then
|
|---|
| 145 | # Beta version is not "the real thing"
|
|---|
| 146 | let major=${X%.*}
|
|---|
| 147 | X=${X%beta*}
|
|---|
| 148 | let minor=${X#*.}-1
|
|---|
| 149 | else
|
|---|
| 150 | let major=0
|
|---|
| 151 | fi
|
|---|
| 152 | if (( (major < 3) || ((major == 3) && (minor < 81)) )); then
|
|---|
| 153 | echo "---> building GNU make 3.81"
|
|---|
| 154 | rm -rf $topdir/tools_build/gmake $topdir/lbin/gmake
|
|---|
| 155 | set -e
|
|---|
| 156 | mkdir -p $topdir/tools_build/gmake
|
|---|
| 157 | cd $topdir/tools_build/gmake
|
|---|
| 158 | env CPPFLAGS="$CPPFLAGS -Dstrcmpi=strcasecmp" \
|
|---|
| 159 | CFLAGS="$(grep '^HOSTCFLAGS' $topdir/lbin/prereq.mk | \
|
|---|
| 160 | sed 's/HOSTCFLAGS:=//')" \
|
|---|
| 161 | $BASH $topdir/tools/gmake/configure \
|
|---|
| 162 | --program-prefix=g \
|
|---|
| 163 | --disable-dependency-tracking \
|
|---|
| 164 | --disable-nls \
|
|---|
| 165 | --without-libiconv-prefix \
|
|---|
| 166 | --without-libintl-prefix
|
|---|
| 167 | make all
|
|---|
| 168 | install -c -s -m 555 make $topdir/lbin/gmake
|
|---|
| 169 | set +e
|
|---|
| 170 | cd $topdir/lbin; ls -l gmake
|
|---|
| 171 | cd $topdir/lbin/tmp
|
|---|
| 172 | fi
|
|---|
| 173 | export PATH=$topdir/lbin:$PATH
|
|---|
| 174 |
|
|---|
| 175 | cat >Makefile <<'EOF'
|
|---|
| 176 | include ${TOPDIR}/lbin/prereq.mk
|
|---|
| 177 | HOSTCFLAGS+= ${FLAG_TEST}
|
|---|
| 178 | all: run-test
|
|---|
| 179 |
|
|---|
| 180 | test: test.c
|
|---|
| 181 | ${HOSTCC} ${HOSTCFLAGS} -o $@ $^ ${LDADD}
|
|---|
| 182 |
|
|---|
| 183 | run-test: test
|
|---|
| 184 | ./test
|
|---|
| 185 | EOF
|
|---|
| 186 | cat >test.c <<-'EOF'
|
|---|
| 187 | #include <stdio.h>
|
|---|
| 188 | int
|
|---|
| 189 | main()
|
|---|
| 190 | {
|
|---|
| 191 | printf("Yay! Native compiler works.\n");
|
|---|
| 192 | return (0);
|
|---|
| 193 | }
|
|---|
| 194 | EOF
|
|---|
| 195 | X=$(gmake TOPDIR=$topdir 2>&1)
|
|---|
| 196 | if [[ $X != *@(Native compiler works)* ]]; then
|
|---|
| 197 | echo "$X" | sed 's/^/| /'
|
|---|
| 198 | echo Cannot compile a simple test programme.
|
|---|
| 199 | echo You must install a host make and C compiler,
|
|---|
| 200 | echo usually GCC, to proceed.
|
|---|
| 201 | echo
|
|---|
| 202 | out=1
|
|---|
| 203 | fi
|
|---|
| 204 | rm test
|
|---|
| 205 |
|
|---|
| 206 | X=$(gmake FLAG_TEST=-fwrapv TOPDIR=$topdir 2>&1)
|
|---|
| 207 | grep '^HOSTCFLAGS.*-fwrapv' ../prereq.mk >/dev/null 2>&1 || \
|
|---|
| 208 | if [[ $X = *@(Native compiler works)* ]]; then
|
|---|
| 209 | printf '/^HOSTCFLAGS/s/$/ -fwrapv/\nwq\n' | ed -s ../prereq.mk
|
|---|
| 210 | else
|
|---|
| 211 | echo "$X" | sed 's/^/| /'
|
|---|
| 212 | fi
|
|---|
| 213 | rm test
|
|---|
| 214 |
|
|---|
| 215 | need_fnotreevrp=0
|
|---|
| 216 | X=$(gmake FLAG_TEST=-fno-tree-vrp TOPDIR=$topdir 2>&1)
|
|---|
| 217 | grep '^HOSTCFLAGS.*-fno-tree-vrp' ../prereq.mk >/dev/null 2>&1 || \
|
|---|
| 218 | if [[ $X = *@(Native compiler works)* ]]; then
|
|---|
| 219 | need_fnotreevrp=1
|
|---|
| 220 | else
|
|---|
| 221 | #echo "$X" | sed 's/^/| /'
|
|---|
| 222 | :
|
|---|
| 223 | fi
|
|---|
| 224 | rm test*
|
|---|
| 225 | if [[ $need_fnotreevrp = 1 ]]; then
|
|---|
| 226 | cat >test.c <<-'EOF'
|
|---|
| 227 | typedef unsigned size_t;
|
|---|
| 228 | char *strncpy(char *, const char *, size_t);
|
|---|
| 229 | char *
|
|---|
| 230 | strncpy(char *d, const char *s, size_t n)
|
|---|
| 231 | {
|
|---|
| 232 | if (!d || !s) {
|
|---|
| 233 | if (d)
|
|---|
| 234 | *d = n;
|
|---|
| 235 | return (d);
|
|---|
| 236 | }
|
|---|
| 237 | return (*d = 1, d);
|
|---|
| 238 | }
|
|---|
| 239 | int
|
|---|
| 240 | main(void)
|
|---|
| 241 | {
|
|---|
| 242 | char a[] = "t";
|
|---|
| 243 | strncpy(a, (void *)0, 2);
|
|---|
| 244 | return (*a);
|
|---|
| 245 | }
|
|---|
| 246 | EOF
|
|---|
| 247 | X=$(gmake test TOPDIR=$topdir 2>&1)
|
|---|
| 248 | if [[ -x test ]]; then
|
|---|
| 249 | ./test >/dev/null 2>&1
|
|---|
| 250 | [[ $? = 2 ]] && need_fnotreevrp=0
|
|---|
| 251 | fi
|
|---|
| 252 | rm test*
|
|---|
| 253 | fi
|
|---|
| 254 | [[ $need_fnotreevrp = 1 ]] && \
|
|---|
| 255 | printf '/^HOSTCFLAGS/s/$/ -fno-tree-vrp/\nwq\n' | ed -s ../prereq.mk
|
|---|
| 256 |
|
|---|
| 257 | if ! which flex >/dev/null 2>&1; then
|
|---|
| 258 | echo You must install flex to continue.
|
|---|
| 259 | echo
|
|---|
| 260 | out=1
|
|---|
| 261 | else
|
|---|
| 262 | echo '%%' | flex -
|
|---|
| 263 | if fgrep _POSIX_SOURCE lex.yy.c; then
|
|---|
| 264 | echo Your lexer \(flex\) contains a broken skeleton.
|
|---|
| 265 | if [[ $NO_ERROR = 1 ]]; then
|
|---|
| 266 | echo WARNING: continue at your own risk.
|
|---|
| 267 | echo Some packages may be broken.
|
|---|
| 268 | else
|
|---|
| 269 | echo You can continue the build by issuing \'make prereq-noerror\'
|
|---|
| 270 | echo However, several packages may faild to build correctly.
|
|---|
| 271 | out=1
|
|---|
| 272 | fi
|
|---|
| 273 | echo
|
|---|
| 274 | fi
|
|---|
| 275 | fi
|
|---|
| 276 |
|
|---|
| 277 | if ! which bison >/dev/null 2>&1; then
|
|---|
| 278 | echo You must install GNU Bison to continue.
|
|---|
| 279 | echo While you can install any version, it is '*STRONGLY*' suggested
|
|---|
| 280 | echo to install GNU Bison version 2.3 because of its bug fixes.
|
|---|
| 281 | echo
|
|---|
| 282 | out=1
|
|---|
| 283 | fi
|
|---|
| 284 | X=$(bison --version 2>&1 | fgrep 'GNU Bison' | sed 's/^[^0-9]*//')
|
|---|
| 285 | V=old
|
|---|
| 286 | if [[ $X = +([0-9]).+([0-9]) ]]; then
|
|---|
| 287 | let major=${X%.*}
|
|---|
| 288 | let minor=${X#*.}
|
|---|
| 289 | if (( (major > 2) || ((major == 2) && (minor >= 3)) )); then
|
|---|
| 290 | V=new
|
|---|
| 291 | fi
|
|---|
| 292 | fi
|
|---|
| 293 | if [[ $V = old ]]; then
|
|---|
| 294 | echo It is suggested to upgrade your copy of bison to
|
|---|
| 295 | echo GNU Bison 2.3 because of its bug fixes.
|
|---|
| 296 | fi
|
|---|
| 297 |
|
|---|
| 298 | if ! which gzip >/dev/null 2>&1; then
|
|---|
| 299 | echo You must install gzip to continue.
|
|---|
| 300 | echo
|
|---|
| 301 | out=1
|
|---|
| 302 | fi
|
|---|
| 303 |
|
|---|
| 304 | if ! which bzip2 >/dev/null 2>&1; then
|
|---|
| 305 | echo You must install bzip2 to continue.
|
|---|
| 306 | echo
|
|---|
| 307 | out=1
|
|---|
| 308 | fi
|
|---|
| 309 |
|
|---|
| 310 | if ! which unzip >/dev/null 2>&1; then
|
|---|
| 311 | echo You must install unzip to continue, sorry.
|
|---|
| 312 | echo
|
|---|
| 313 | out=1
|
|---|
| 314 | fi
|
|---|
| 315 |
|
|---|
| 316 | if ! which zip >/dev/null 2>&1; then
|
|---|
| 317 | echo You must install zip to continue, sorry.
|
|---|
| 318 | echo
|
|---|
| 319 | out=1
|
|---|
| 320 | fi
|
|---|
| 321 |
|
|---|
| 322 | if ! which patch >/dev/null 2>&1; then
|
|---|
| 323 | echo You must install patch \(from Larry Wall\) to continue.
|
|---|
| 324 | echo
|
|---|
| 325 | out=1
|
|---|
| 326 | fi
|
|---|
| 327 |
|
|---|
| 328 | cat >test.c <<-'EOF'
|
|---|
| 329 | #include <stdio.h>
|
|---|
| 330 | #include <zlib.h>
|
|---|
| 331 |
|
|---|
| 332 | #ifndef STDIN_FILENO
|
|---|
| 333 | #define STDIN_FILENO 0
|
|---|
| 334 | #endif
|
|---|
| 335 |
|
|---|
| 336 | int
|
|---|
| 337 | main()
|
|---|
| 338 | {
|
|---|
| 339 | gzFile zstdin;
|
|---|
| 340 | char buf[1024];
|
|---|
| 341 | int i;
|
|---|
| 342 |
|
|---|
| 343 | zstdin = gzdopen(STDIN_FILENO, "rb");
|
|---|
| 344 | i = gzread(zstdin, buf, sizeof (buf));
|
|---|
| 345 | if ((i > 0) && (i < sizeof (buf)))
|
|---|
| 346 | buf[i] = '\0';
|
|---|
| 347 | buf[sizeof (buf) - 1] = '\0';
|
|---|
| 348 | printf("%s\n", buf);
|
|---|
| 349 | return (0);
|
|---|
| 350 | }
|
|---|
| 351 | EOF
|
|---|
| 352 | X=$(echo 'Yay! Native compiler works.' | gzip | \
|
|---|
| 353 | gmake TOPDIR=$topdir LDADD=-lz 2>&1)
|
|---|
| 354 | if [[ $X != *@(Native compiler works)* ]]; then
|
|---|
| 355 | echo "$X" | sed 's/^/| /'
|
|---|
| 356 | echo Cannot compile a libz test programme.
|
|---|
| 357 | echo You must install the zlib development package,
|
|---|
| 358 | echo usually called libz-dev, and the run-time library.
|
|---|
| 359 | echo
|
|---|
| 360 | out=1
|
|---|
| 361 | fi
|
|---|
| 362 |
|
|---|
| 363 | [[ -s /usr/include/ncurses.h ]] || if [[ -s /usr/pkg/include/ncurses.h ]]; then
|
|---|
| 364 | echo 'HOSTCFLAGS+= -isystem /usr/pkg/include' >>$topdir/lbin/prereq.mk
|
|---|
| 365 | echo 'HOSTLDFLAGS+=-L/usr/pkg/lib -Wl,-rpath -Wl,/usr/pkg/lib' >>$topdir/lbin/prereq.mk
|
|---|
| 366 | else
|
|---|
| 367 | echo Install ncurses header files, please.
|
|---|
| 368 | echo
|
|---|
| 369 | out=1
|
|---|
| 370 | fi
|
|---|
| 371 |
|
|---|
| 372 | if ! which g++ >/dev/null 2>&1; then
|
|---|
| 373 | echo You must install the host GNU C++ compiler to continue.
|
|---|
| 374 | echo
|
|---|
| 375 | out=1
|
|---|
| 376 | fi
|
|---|
| 377 |
|
|---|
| 378 | if ! which perl >/dev/null 2>&1; then
|
|---|
| 379 | #if [[ "$(which perl 2>/dev/null)" != /usr/bin/perl ]]; then
|
|---|
| 380 | echo You must install Perl in /usr/bin to continue.
|
|---|
| 381 | echo
|
|---|
| 382 | out=1
|
|---|
| 383 | fi
|
|---|
| 384 |
|
|---|
| 385 | if ! which wget >/dev/null 2>&1; then
|
|---|
| 386 | echo You must install GNU wget to continue.
|
|---|
| 387 | echo
|
|---|
| 388 | out=1
|
|---|
| 389 | fi
|
|---|
| 390 |
|
|---|
| 391 | if ! which makeinfo >/dev/null 2>&1; then
|
|---|
| 392 | echo You must install GNU texinfo to continue.
|
|---|
| 393 | echo
|
|---|
| 394 | out=1
|
|---|
| 395 | fi
|
|---|
| 396 |
|
|---|
| 397 | if ! which ed >/dev/null 2>&1; then
|
|---|
| 398 | echo Why does your distribution not package the standard
|
|---|
| 399 | echo text editor, ed? Please install it to continue.
|
|---|
| 400 | echo
|
|---|
| 401 | out=1
|
|---|
| 402 | elif [[ "$(PATH=/bin:$PATH which ed 2>/dev/null)" != /bin/ed ]]; then
|
|---|
| 403 | echo Your operating system installs ed, the standard text
|
|---|
| 404 | echo editor, not as /bin/ed. While you can build FreeWRT
|
|---|
| 405 | echo with this, ask your vendor to fix it, point to the
|
|---|
| 406 | echo FHS if needed.
|
|---|
| 407 | echo
|
|---|
| 408 | fi
|
|---|
| 409 |
|
|---|
| 410 | if ! which file >/dev/null 2>&1; then
|
|---|
| 411 | echo You must install \"file\" to continue.
|
|---|
| 412 | echo
|
|---|
| 413 | out=1
|
|---|
| 414 | fi
|
|---|
| 415 |
|
|---|
| 416 | have_tsort=0
|
|---|
| 417 | if which tsort >/dev/null 2>&1; then
|
|---|
| 418 | v=$(printf 'a b\nb c\n' | tsort -r 2>/dev/null | md5sum)
|
|---|
| 419 | [[ ${v%% *} = 0617bc44e824dd65da71d04b29c85e63 ]] && have_tsort=1
|
|---|
| 420 | fi
|
|---|
| 421 |
|
|---|
| 422 | if [[ $have_tsort = 0 ]]; then
|
|---|
| 423 | bmake=
|
|---|
| 424 | else
|
|---|
| 425 | for x in $bmake $(which mmake) $(which bmake) /usr/bin/make; do
|
|---|
| 426 | bmake=
|
|---|
| 427 | y=$(printf 't:\n\t@echo ${_MIRMAKE_VER}\n' | \
|
|---|
| 428 | $x -f - t 2>/dev/null)
|
|---|
| 429 | [[ $y = +([0-9]) ]] || continue
|
|---|
| 430 | [[ $y < 20070626 ]] && continue
|
|---|
| 431 | bmake=$x
|
|---|
| 432 | break
|
|---|
| 433 | done
|
|---|
| 434 | fi
|
|---|
| 435 | [[ $bmake = $topdir/lbin/bmake ]] && bmake=
|
|---|
| 436 |
|
|---|
| 437 | if [[ $have_tsort = 0 || -z $bmake ]]; then
|
|---|
| 438 | echo USE_TOOLS_MIRMAKE=1 >>$topdir/lbin/prereq.mk
|
|---|
| 439 | bmake=$topdir/lbin/bmake
|
|---|
| 440 | if ! which mksh >/dev/null 2>&1; then
|
|---|
| 441 | echo USE_TOOLS_MKSH=1 >>$topdir/lbin/prereq.mk
|
|---|
| 442 | fi
|
|---|
| 443 | fi
|
|---|
| 444 |
|
|---|
| 445 | echo "BMAKE='$bmake'" >>$topdir/lbin/prereq.mk
|
|---|
| 446 |
|
|---|
| 447 | if grep USE_TOOLS_MKSH=1 $topdir/lbin/prereq.mk >/dev/null 2>&1; then
|
|---|
| 448 | echo "MBSH:=$topdir/lbin/mkshw" >>$topdir/lbin/prereq.mk
|
|---|
| 449 | rm -f $topdir/lbin/mkshw
|
|---|
| 450 | cat >$topdir/lbin/mkshw <<-EOF
|
|---|
| 451 | #!/bin/sh
|
|---|
| 452 | if [[ -x $topdir/lbin/mksh ]]; then
|
|---|
| 453 | exec $topdir/lbin/mksh "\$@"
|
|---|
| 454 | else
|
|---|
| 455 | exec bash "\$@"
|
|---|
| 456 | fi
|
|---|
| 457 | EOF
|
|---|
| 458 | chmod +x $topdir/lbin/mkshw
|
|---|
| 459 | elif which mksh >/dev/null 2>&1; then
|
|---|
| 460 | echo "MBSH:=$(which mksh)" >>$topdir/lbin/prereq.mk
|
|---|
| 461 | else
|
|---|
| 462 | echo "MBSH:=$${BASH}" >>$topdir/lbin/prereq.mk
|
|---|
| 463 | fi
|
|---|
| 464 |
|
|---|
| 465 |
|
|---|
| 466 | cd $topdir
|
|---|
| 467 | rm -rf lbin/tmp
|
|---|
| 468 |
|
|---|
| 469 | # populate some more tools
|
|---|
| 470 | cat >lbin/autoconf <<-EOF
|
|---|
| 471 | #!$BASH
|
|---|
| 472 | echo '===> Warning: this package calls autoconf!'
|
|---|
| 473 | exit 0
|
|---|
| 474 | EOF
|
|---|
| 475 | cp lbin/autoconf lbin/autoheader
|
|---|
| 476 | for v in 2.13 2.52 2.53 2.54 2.55 2.56 2.57 2.58 2.59 2.60 2.61; do
|
|---|
| 477 | cp lbin/autoconf lbin/autoconf-$v
|
|---|
| 478 | cp lbin/autoconf lbin/autoheader-$v
|
|---|
| 479 | done
|
|---|
| 480 | cat >lbin/automake <<-EOF
|
|---|
| 481 | #!$BASH
|
|---|
| 482 | echo '===> Warning: this package calls automake!'
|
|---|
| 483 | exit 0
|
|---|
| 484 | EOF
|
|---|
| 485 | cp lbin/automake lbin/aclocal
|
|---|
| 486 | for v in 1.4 1.5 1.6 1.7 1.8 1.9 1.10; do
|
|---|
| 487 | cp lbin/automake lbin/automake-$v
|
|---|
| 488 | cp lbin/automake lbin/aclocal-$v
|
|---|
| 489 | done
|
|---|
| 490 | chmod a+x lbin/{autoconf,autoheader,automake,aclocal}*
|
|---|
| 491 |
|
|---|
| 492 | exit $out
|
|---|