picobsd (277639) | picobsd (262761) |
---|---|
1#!/bin/sh - 2# | 1#!/bin/sh - 2# |
3# $FreeBSD: stable/10/release/picobsd/build/picobsd 277639 2015-01-24 06:11:13Z luigi $ | 3# $FreeBSD: stable/10/release/picobsd/build/picobsd 262761 2014-03-05 00:45:28Z gjb $ |
4# This file requires sysutils/makefs to run 5# 6# The PicoBSD build script. Invoked as 7# 8# picobsd [options] image_type [site_name] 9# 10# CWARNFLAGS can be used to pass -Wall or similar options 11# --- 74 unchanged lines hidden (view full) --- 86 [ ${o_verbose} -gt 0 ] && printf "\n*** %s\n" "$*" 87 [ ${o_verbose} -gt 1 ] && read -p "=== Press enter to continue" foo 88 return 0 89} 90 91# unconditionally log and wait for input 92logverbose() { # message 93 local foo | 4# This file requires sysutils/makefs to run 5# 6# The PicoBSD build script. Invoked as 7# 8# picobsd [options] image_type [site_name] 9# 10# CWARNFLAGS can be used to pass -Wall or similar options 11# --- 74 unchanged lines hidden (view full) --- 86 [ ${o_verbose} -gt 0 ] && printf "\n*** %s\n" "$*" 87 [ ${o_verbose} -gt 1 ] && read -p "=== Press enter to continue" foo 88 return 0 89} 90 91# unconditionally log and wait for input 92logverbose() { # message 93 local foo |
94 printf "\n*** %s\n" "$*" >&2 | 94 printf "\n*** %s\n" "$*" |
95 read -p "=== Press enter to continue" foo 96 return 0 97} 98 99# set some default values for variables. 100# needs to be done as the first thing in the script. 101 102set_defaults() { # no arguments --- 56 unchanged lines hidden (view full) --- 159 trap fail 15 160} 161 162# use the new build infrastructure to create libraries 163# and also to build a specific target 164create_includes_and_libraries2() { # opt_dir opt_target 165 local no 166 log "create_includes_and_libraries2() for ${SRC} $1" | 95 read -p "=== Press enter to continue" foo 96 return 0 97} 98 99# set some default values for variables. 100# needs to be done as the first thing in the script. 101 102set_defaults() { # no arguments --- 56 unchanged lines hidden (view full) --- 159 trap fail 15 160} 161 162# use the new build infrastructure to create libraries 163# and also to build a specific target 164create_includes_and_libraries2() { # opt_dir opt_target 165 local no 166 log "create_includes_and_libraries2() for ${SRC} $1" |
167 168 no="-DNO_CLEAN -DNO_PROFILE -DNO_GAMES -DNO_LIBC_R" # WITHOUT_CDDL=1" 169 no="$no -DWITHOUT_CASPER" 170 no="$no -DMALLOC_PRODUCTION" 171 | 167 if [ ${OSVERSION} -ge 600000 ] ; then 168 no="-DNO_CLEAN -DNO_PROFILE -DNO_GAMES -DNO_LIBC_R" # WITHOUT_CDDL=1" 169 no="$no -DWITHOUT_CLANG -DMALLOC_PRODUCTION" 170 else 171 no="-DNOCLEAN -DNOPROFILE -DNOGAMES -DNOLIBC_R" 172 fi |
172 ( cd ${SRC}; 173 # make -DNOCLEAN -DNOPROFILE -DNOGAMES -DNOLIBC_R -DPICOBSD buildworld 174 if [ -d "$1" ] ; then 175 cd $1 ; ${BINMAKE} ${o_par} $2 # specific target, e.g. ld-elf.so 176 else 177 export MAKEOBJDIRPREFIX=${l_objtree} 178 make ${o_par} $no toolchain | 173 ( cd ${SRC}; 174 # make -DNOCLEAN -DNOPROFILE -DNOGAMES -DNOLIBC_R -DPICOBSD buildworld 175 if [ -d "$1" ] ; then 176 cd $1 ; ${BINMAKE} ${o_par} $2 # specific target, e.g. ld-elf.so 177 else 178 export MAKEOBJDIRPREFIX=${l_objtree} 179 make ${o_par} $no toolchain |
179 | |
180 # XXX do we need any of these ? 181 eval export `cd ${SRC}; ${BINMAKE} -f Makefile.inc1 -V WMAKEENV` 182 [ ${o_arch} != `uname -m` ] && \ 183 (cd ${l_objtree}; ln -s . ${o_arch}.${o_arch} || true ) 184 fi 185 ) 186} 187 | 180 # XXX do we need any of these ? 181 eval export `cd ${SRC}; ${BINMAKE} -f Makefile.inc1 -V WMAKEENV` 182 [ ${o_arch} != `uname -m` ] && \ 183 (cd ${l_objtree}; ln -s . ${o_arch}.${o_arch} || true ) 184 fi 185 ) 186} 187 |
188# entry for 4.x and earlier trees 189create_includes_and_libraries() { 190 local e i |
|
188 | 191 |
192 log "create_includes_and_libraries() for ${SRC}" 193 # Optionally creates include directory and libraries. 194 mkdir -p ${l_usrtree}/include # the include directory... 195 mkdir -p ${l_usrtree}/share/misc # a few things go here 196 mkdir -p ${l_usrtree}/lib # libraries 197 mkdir -p ${l_usrtree}/sbin # some binaries 198 # override variables for ownershiip and destinations 199 # BINOWN:BINGRP are also used for include files 200 (cd ${SRC}; \ 201 BINOWN=`id -un` BINGRP=`id -gn` \ 202 DESTDIR=${l_usrtree}/.. \ 203 make -m ${SRC}/share/mk includes ) || fail $? includes 204 # Pick up the correct headers for libraries. 205 CFLAGS="-nostdinc -I${l_usrtree}/include" ; export CFLAGS 206 207 (cd ${SRC} 208 # $e is the invocation of make with correct environment 209 # XXX check the NO* options below, maybe system dependent. 210 e="MAKEOBJDIRPREFIX=${l_objtree}/picobsd/libraries \ 211 BINOWN=`id -un` BINGRP=`id -gn` \ 212 DESTDIR=${l_usrtree}/.. \ 213 make -m ${SRC}/share/mk \ 214 -DNOHTML -DNOINFO -DNOMAN -DNOSHARE -DNOFSCHG " 215 log "do a 'make obj' in a few places." 216 # This is very version-specific... The following works for 5.0 217 for i in lib secure/lib gnu/lib \ 218 gnu/usr.bin/perl usr.bin/lex usr.sbin/config ; do 219 (cd ${i}; eval $e obj) 220 done 221 log "now make the static libraries" 222 eval $e -DNOPROFILE -DNOPIC libraries 223 (cd ${SRC}/usr.sbin/config 224 eval $e # build binary 225 eval $e install # install it 226 ) 227 ) || fail $? "libraries" 228 log "Libraries done" 229} 230 |
|
189# set_type <the_type> [the_site] looks in user or system directories 190# for the directory named as the first argument, reads the configuration 191# files and sets variables according to the config. 192# Also sets MY_TREE and BUILDDIR and SITE 193 194set_type() { # the_type the_site 195 local a i 196 --- 193 unchanged lines hidden (view full) --- 390do_kernel() { # OK 391 log "do_kernel() Preparing kernel \"$name\" in $MY_TREE" 392 (cd $MY_TREE; export name SRC BUILDDIR # used in this makefile ; 393 # export CONFIG 394 export WARNS CWARNFLAGS 395 [ "${o_do_modules}" = "yes" ] && export MODULES="" 396 # kernel build not parallelizable yet 397 ${BINMAKE} KERNCONF=${l_kernconf} \ | 231# set_type <the_type> [the_site] looks in user or system directories 232# for the directory named as the first argument, reads the configuration 233# files and sets variables according to the config. 234# Also sets MY_TREE and BUILDDIR and SITE 235 236set_type() { # the_type the_site 237 local a i 238 --- 193 unchanged lines hidden (view full) --- 432do_kernel() { # OK 433 log "do_kernel() Preparing kernel \"$name\" in $MY_TREE" 434 (cd $MY_TREE; export name SRC BUILDDIR # used in this makefile ; 435 # export CONFIG 436 export WARNS CWARNFLAGS 437 [ "${o_do_modules}" = "yes" ] && export MODULES="" 438 # kernel build not parallelizable yet 439 ${BINMAKE} KERNCONF=${l_kernconf} \ |
398 -f ${PICO_TREE}/build/Makefile.conf ) || \ | 440 -v -f ${PICO_TREE}/build/Makefile.conf ) || \ |
399 fail $? missing_kernel 400} 401 402# Populate the variable part of the floppy filesystem. Must be done before 403# the MFS because its content might need to be copied there as well. 404# 405# This involves fetching files from three subtrees, in this order: 406# --- 116 unchanged lines hidden (view full) --- 523# find_progs nvi sed less grep 524# cp -p ${u_progs} ${dst}/bin 525# cp -p ${u_libs} ${dst}/lib 526# mkdir -p ${dst}/libexec 527# find_progs ld-elf.so.1 528# cp -p ${u_progs} ${dst}/libexec # ignore errors 529# } 530 | 441 fail $? missing_kernel 442} 443 444# Populate the variable part of the floppy filesystem. Must be done before 445# the MFS because its content might need to be copied there as well. 446# 447# This involves fetching files from three subtrees, in this order: 448# --- 116 unchanged lines hidden (view full) --- 565# find_progs nvi sed less grep 566# cp -p ${u_progs} ${dst}/bin 567# cp -p ${u_libs} ${dst}/lib 568# mkdir -p ${dst}/libexec 569# find_progs ld-elf.so.1 570# cp -p ${u_progs} ${dst}/libexec # ignore errors 571# } 572 |
531# find programs and required libraries. Accept -L libs -P path <progs> 532# if no argument default to objdir/SHLIBDIRPREFIX for both | |
533find_progs() { # programs | 573find_progs() { # programs |
534 # logverbose "find_progs: called with $*" 535 local i=`realpath ${o_objdir:-${_SHLIBDIRPREFIX}/..}` 536 # default values for -L and -P 537 local dir="-P $i" 538 local ldir="-L $i" 539 540 while [ "$1" != "" ] ; do 541 if [ x"$1" = "x-L" -a -d "$2" ] ; then # set lib search path 542 ldir="-L $2"; shift; shift 543 elif [ x"$1" = "x-P" -a -d "$2" ] ; then # set prog search path 544 dir="-P $2"; shift; shift 545 else 546 break 547 fi 548 done 549 550 # Results are returned in global variables 551 u_libs="" 552 u_progs="`find_progs_helper $dir $*`" | 574 local pass i old_libs="" tmp o="" 575 if [ x"$1" = "x-L" -a -d "$2" ] ; then # set lib search path 576 o="-P $2"; shift; shift 577 fi 578 # Result returned in global variables 579 u_libs="" ; u_progs="`find_progs_helper $*`" |
553 [ -z "${u_progs}" ] && return 1 # not found, error | 580 [ -z "${u_progs}" ] && return 1 # not found, error |
554 555 # use objdump to find libraries. 556 # Iterate to fetch recursive dependencies. 557 local tmp="${u_progs}" 558 local old_libs="" 559 local pass=1 | 581 # use objdump to find libraries. Iterate to fetch recursive 582 # dependencies. 583 tmp="${u_progs}" ; pass=1 |
560 while [ $pass -lt 10 ] ; do 561 pass=$(($pass + 1)) 562 i="`objdump -x ${tmp} | \ | 584 while [ $pass -lt 10 ] ; do 585 pass=$(($pass + 1)) 586 i="`objdump -x ${tmp} | \ |
563 awk '$1 == "NEEDED" { print $2 }' | sort | uniq | tr '\n' ' '`" | 587 awk '$1 == "NEEDED" { print $2 }' | sort | uniq`" |
564 if [ "$old_libs" = "$i" ] ; then | 588 if [ "$old_libs" = "$i" ] ; then |
565 # logverbose "find_progs: have `echo ${u_libs} | wc -w`/`echo ${i} | wc -w` libraries for: $my_progs ($u_progs)" 566 # logverbose "they are ($i) $u_libs" | 589 log "libraries for: $my_progs ($u_progs) are ($i) $u_libs" 590 log "--- done find_progs ---" |
567 return 0 568 else 569 # logverbose "old--- $old_libs --- new +++ $i +++" 570 fi | 591 return 0 592 else 593 # logverbose "old--- $old_libs --- new +++ $i +++" 594 fi |
571 u_libs="`find_progs_helper $ldir $i`" | 595 u_libs="`find_progs_helper $o $i`" |
572 old_libs="$i" 573 tmp="$tmp $u_libs" 574 done 575 log "WARNING: Too many passes, giving up" 576} 577 | 596 old_libs="$i" 597 tmp="$tmp $u_libs" 598 done 599 log "WARNING: Too many passes, giving up" 600} 601 |
578# prints to stdout files and libs in the search paths 579find_progs_helper() { # first arg is either -P or -L 580 local ty=$1 dir=$2 ; shift; shift 581 local progs="`echo $* | tr ' ' '\n' | sort -u | tr '\n' ' '`" 582 # first, extract absolute pathnames or files in this directory 583 584 # accumulate others in $names 585 local names="" | 602find_progs_helper() { # programs 603 local dir=${o_objdir:-${_SHLIBDIRPREFIX}/..} 604 local ldir="" 605 if [ x"$1" = "x-P" -a -d "$2" ] ; then # set path 606 ldir=$2; shift; shift 607 fi 608 local progs="$*" 609 local subdirs=". local/bin local/sbin local/lib local/libexec \ 610 bin sbin usr.bin usr.sbin libexec lib \ 611 gnu/usr.bin gnu/lib \ 612 secure/usr.bin secure/usr.sbin secure/libexec secure/lib" 613 local names="" # files to search 614 local o="" |
586 local i 587 for i in $progs ; do | 615 local i 616 for i in $progs ; do |
588 [ -f "$i" ] && echo `realpath $i` && continue 589 names="${names} $i" | 617 # full pathnames are just listed 618 [ -f "$i" ] && echo $i && continue 619 names="${names} ${o} -name $i" 620 o="-o" |
590 done | 621 done |
591 # if nothing left, we are done | |
592 [ -z "${names}" ] && return 0 | 622 [ -z "${names}" ] && return 0 |
593 594 local depth p 595 local places="" # places to search 596 if [ x-P = "x$ty" ] ; then # search programs 597 depth=2 598 p=". local/bin local/sbin local/libexec \ 599 bin sbin usr/bin usr/sbin libexec gnu/usr.bin \ 600 secure/usr.bin secure/usr.sbin secure/libexec " 601 else 602 depth=3 603 p="lib usr/lib gnu/lib secure/lib" | 623 local places="" # places to search 624 for i in $subdirs ; do 625 [ -d "${dir}/${i}" ] && places="${places} ${dir}/${i}" 626 done 627 if [ -n "${ldir}" ] ; then 628 for i in $subdirs ; do 629 [ -d "${ldir}/${i}" ] && places="${places} ${ldir}/${i}" 630 done |
604 fi | 631 fi |
605 for i in $p ; do 606 i="${dir}/${i}" 607 [ -d "${i}" ] && places="${places} `realpath ${i}`" | 632 for i in $progs ; do 633 # full pathnames are just listed 634 [ -f "$i" ] && echo $i && continue 635 find ${places} -maxdepth 3 -type f -name ${i} | head -1 |
608 done | 636 done |
609 # logverbose "--- looking into $places" 610 places=`echo ${places} | tr ' ' '\n' | sort -u` 611 for i in $names ; do 612 find ${places} -maxdepth $depth -type f -name ${i} | head -1 613 done | 637 # use maxdepth 3 because some libs are way down |
614} 615 616# Populate the memory filesystem with binaries and non-variable 617# configuration files. 618# First do an mtree pass, then create directory links and device entries, 619# then run crunchgen etc. to build the binary and create links. 620# Then copy the specific/generic mfs_tree. 621# Finally, if required, make a copy of the floppy.tree onto /fd --- 26 unchanged lines hidden (view full) --- 648 649 ### now build the crunched binaries ### 650 ( 651 cd ${BUILDDIR}/crunch 652 log "Making and installing crunch1 from `pwd` src ${SRC}..." 653 a=${BUILDDIR}/crunch1.conf 654 ( export BUILDDIR SRC MY_TREE PICO_OBJ ; 655 ${BINMAKE} \ | 638} 639 640# Populate the memory filesystem with binaries and non-variable 641# configuration files. 642# First do an mtree pass, then create directory links and device entries, 643# then run crunchgen etc. to build the binary and create links. 644# Then copy the specific/generic mfs_tree. 645# Finally, if required, make a copy of the floppy.tree onto /fd --- 26 unchanged lines hidden (view full) --- 672 673 ### now build the crunched binaries ### 674 ( 675 cd ${BUILDDIR}/crunch 676 log "Making and installing crunch1 from `pwd` src ${SRC}..." 677 a=${BUILDDIR}/crunch1.conf 678 ( export BUILDDIR SRC MY_TREE PICO_OBJ ; 679 ${BINMAKE} \ |
656 -f ${PICO_TREE}/build/Makefile.conf ${BUILDDIR}/crunch.mk ) | 680 -v -f ${PICO_TREE}/build/Makefile.conf ${BUILDDIR}/crunch.mk ) |
657 log "Libs are ${LIBS} " 658 export SRC # used by crunch.mk 659 # export LIBS CFLAGS 660 log "Now make -f crunch.mk" 661 ${BINMAKE} ${o_makeopts} -f ${BUILDDIR}/crunch.mk 662 strip --remove-section=.note --remove-section=.comment crunch1 663 mv crunch1 ${dst}/stand/crunch 664 chmod 555 ${dst}/stand/crunch --- 52 unchanged lines hidden (view full) --- 717 ) 718 fi 719 if [ "`id -u`" = "0" ] ; then 720 log "Fixing permissions" 721 (cd ${dst}; chown -R root . ) 722 fi 723 724 log "for a shared 'crunch' take libraries and dynamic loader as well" | 681 log "Libs are ${LIBS} " 682 export SRC # used by crunch.mk 683 # export LIBS CFLAGS 684 log "Now make -f crunch.mk" 685 ${BINMAKE} ${o_makeopts} -f ${BUILDDIR}/crunch.mk 686 strip --remove-section=.note --remove-section=.comment crunch1 687 mv crunch1 ${dst}/stand/crunch 688 chmod 555 ${dst}/stand/crunch --- 52 unchanged lines hidden (view full) --- 741 ) 742 fi 743 if [ "`id -u`" = "0" ] ; then 744 log "Fixing permissions" 745 (cd ${dst}; chown -R root . ) 746 fi 747 748 log "for a shared 'crunch' take libraries and dynamic loader as well" |
725 # /stand/crunch is our main binary, we extract its libs | |
726 find_progs ${dst}/stand/crunch 727 if [ -n "${u_libs}" ] ; then 728 mkdir -p ${dst}/lib && cp -p ${u_libs} ${dst}/lib 729 mkdir -p ${dst}/libexec 730 create_includes_and_libraries2 libexec/rtld-elf 731 find_progs ld-elf.so.1 && cp -p ${u_progs} ${dst}/libexec 732 fi 733 --- 119 unchanged lines hidden (view full) --- 853 mfs_ofs=$((${mfs_start} + 8192)) 854 log "Preload kernel with file ${c_fs} at ${mfs_ofs}" 855 log "`ls -l ${c_fs}` to fit in ${mfs_size}" 856 dd if=${c_fs} ibs=8192 iseek=1 of=kernel obs=${mfs_ofs} \ 857 oseek=1 conv=notrunc # 2> /dev/null 858 else 859 log "not loading mfs, size ${mfs_size} img ${imgsize}" 860 fi | 749 find_progs ${dst}/stand/crunch 750 if [ -n "${u_libs}" ] ; then 751 mkdir -p ${dst}/lib && cp -p ${u_libs} ${dst}/lib 752 mkdir -p ${dst}/libexec 753 create_includes_and_libraries2 libexec/rtld-elf 754 find_progs ld-elf.so.1 && cp -p ${u_progs} ${dst}/libexec 755 fi 756 --- 119 unchanged lines hidden (view full) --- 876 mfs_ofs=$((${mfs_start} + 8192)) 877 log "Preload kernel with file ${c_fs} at ${mfs_ofs}" 878 log "`ls -l ${c_fs}` to fit in ${mfs_size}" 879 dd if=${c_fs} ibs=8192 iseek=1 of=kernel obs=${mfs_ofs} \ 880 oseek=1 conv=notrunc # 2> /dev/null 881 else 882 log "not loading mfs, size ${mfs_size} img ${imgsize}" 883 fi |
861 log "Compress with gzip and copy to floppy image" | 884 log "Compress with kgzip and copy to floppy image" |
862 863 mkdir -p ${dst}/boot/kernel 864 # XXX loader.conf does not work unless we also load the .4th files 865 # echo "hint.acpi.0.disabled=\"1\"" > ${dst}/boot/loader.conf 866 # echo "console=\"comconsole\"" >> ${dst}/boot/loader.conf 867 local blf="loader* *.4th" # loader.rc loader.4th support.4th" 868 (cd /boot; cp -p loader ${dst}/boot) || fail $? no_space "copying bootloader" 869 cp ${MY_TREE}/floppy.tree/boot/loader.conf ${dst}/boot || true --- 46 unchanged lines hidden (view full) --- 916 # XXX secondary starts after the 0x114 = dec 276 bytes of the label 917 # so we skip 276 from the source, and 276+512=788 from dst 918 # the old style blocks used 512 and 1024 respectively 919 920 dd if=${c_boot2} iseek=1 ibs=276 2> /dev/null | \ 921 dd of=${BUILDDIR}/${c_img} oseek=1 obs=788 conv=notrunc 2>/dev/null 922 log "done disk image" 923 # XXX (log "Fixing permissions"; cd ${dst}; chown -R root *) | 885 886 mkdir -p ${dst}/boot/kernel 887 # XXX loader.conf does not work unless we also load the .4th files 888 # echo "hint.acpi.0.disabled=\"1\"" > ${dst}/boot/loader.conf 889 # echo "console=\"comconsole\"" >> ${dst}/boot/loader.conf 890 local blf="loader* *.4th" # loader.rc loader.4th support.4th" 891 (cd /boot; cp -p loader ${dst}/boot) || fail $? no_space "copying bootloader" 892 cp ${MY_TREE}/floppy.tree/boot/loader.conf ${dst}/boot || true --- 46 unchanged lines hidden (view full) --- 939 # XXX secondary starts after the 0x114 = dec 276 bytes of the label 940 # so we skip 276 from the source, and 276+512=788 from dst 941 # the old style blocks used 512 and 1024 respectively 942 943 dd if=${c_boot2} iseek=1 ibs=276 2> /dev/null | \ 944 dd of=${BUILDDIR}/${c_img} oseek=1 obs=788 conv=notrunc 2>/dev/null 945 log "done disk image" 946 # XXX (log "Fixing permissions"; cd ${dst}; chown -R root *) |
924 df -ik ${dst} | colrm 70 > .build.reply | |
925 # leave build stuff if verbose 926 [ ${o_verbose} -gt 0 ] && return 927 928 rm -rf ${BUILDDIR}/floppy.tree || true # cleanup | 947 # leave build stuff if verbose 948 [ ${o_verbose} -gt 0 ] && return 949 950 rm -rf ${BUILDDIR}/floppy.tree || true # cleanup |
951 # df -ik ${dst} | colrm 70 > .build.reply |
|
929 rm -rf ${dst} 930 rm ${BUILDDIR}/${c_fs} 931 # rm ${BUILDDIR}/kernel.gz 932} 933 934# This function creates variables which depend on the source tree in use: 935# SRC, l_usrtree, l_objtree 936# Optionally creates libraries, includes and the like (for cross compiles, --- 6 unchanged lines hidden (view full) --- 943 l_usrtree=${USR:-${SRC}/../usr} 944 fi 945 l_objtree=${l_usrtree}/obj-pico-${o_arch} 946 947 PICO_TREE=${PICO_TREE:-${SRC}/release/picobsd} 948 set `grep "#define[\t ]__FreeBSD_version" ${SRC}/sys/sys/param.h` 949 OSVERSION=$3 950 log "OSVERSION is ${OSVERSION}" | 952 rm -rf ${dst} 953 rm ${BUILDDIR}/${c_fs} 954 # rm ${BUILDDIR}/kernel.gz 955} 956 957# This function creates variables which depend on the source tree in use: 958# SRC, l_usrtree, l_objtree 959# Optionally creates libraries, includes and the like (for cross compiles, --- 6 unchanged lines hidden (view full) --- 966 l_usrtree=${USR:-${SRC}/../usr} 967 fi 968 l_objtree=${l_usrtree}/obj-pico-${o_arch} 969 970 PICO_TREE=${PICO_TREE:-${SRC}/release/picobsd} 971 set `grep "#define[\t ]__FreeBSD_version" ${SRC}/sys/sys/param.h` 972 OSVERSION=$3 973 log "OSVERSION is ${OSVERSION}" |
951 | 974 if [ ${OSVERSION} -ge 500035 ] ; then |
952 export MAKEOBJDIRPREFIX=${l_objtree} 953 export TARGET_ARCH=${o_arch} TARGET=${o_arch} | 975 export MAKEOBJDIRPREFIX=${l_objtree} 976 export TARGET_ARCH=${o_arch} TARGET=${o_arch} |
954 # XXX 20131001 see if CLANG fixes the build 955 export WITHOUT_CLANG_IS_CC=yes 956 export WITHOUT_CLANG_BOOTSTRAP=yes 957 export WITH_GCC=yes 958 export WITH_GCC_BOOTSTRAP=yes 959 export WITH_GNUCXX=yes 960 export WITHOUT_CLANG=yes 961 export WITHOUT_ICONV=yes 962 | 977 export WITHOUT_CLANG_IS_CC=1 |
963 # XXX why change machine_arch ? 964 #-- export MACHINE_ARCH=`uname -m` MACHINE=`uname -m` 965 # export CWARNFLAGS="-Wextra -Wno-sign-compare -Wno-missing-field-initializers" | 978 # XXX why change machine_arch ? 979 #-- export MACHINE_ARCH=`uname -m` MACHINE=`uname -m` 980 # export CWARNFLAGS="-Wextra -Wno-sign-compare -Wno-missing-field-initializers" |
966 # XXX BINMAKE does not really exist anymore | |
967 eval "export BINMAKE=\"`cd ${SRC}; make -f Makefile -V BINMAKE`\"" 968 [ "$BINMAKE" = "" ] && \ 969 eval "export BINMAKE=\"`cd ${SRC}; make -f Makefile -V SUB_MAKE`\"" | 981 eval "export BINMAKE=\"`cd ${SRC}; make -f Makefile -V BINMAKE`\"" 982 [ "$BINMAKE" = "" ] && \ 983 eval "export BINMAKE=\"`cd ${SRC}; make -f Makefile -V SUB_MAKE`\"" |
984 fi |
|
970 971 if [ "${o_init_src}" != "" ] ; then | 985 986 if [ "${o_init_src}" != "" ] ; then |
972 create_includes_and_libraries2 | 987 if [ ${OSVERSION} -lt 500035 ] ; then 988 create_includes_and_libraries 989 else 990 create_includes_and_libraries2 991 fi |
973 else 974 eval export `cd ${SRC}; ${BINMAKE} -f Makefile.inc1 -V WMAKEENV` 975 fi | 992 else 993 eval export `cd ${SRC}; ${BINMAKE} -f Makefile.inc1 -V WMAKEENV` 994 fi |
995 if [ ${OSVERSION} -lt 500035 ] ; then 996 # Create the right LIBS and CFLAGS for further builds. 997 # and build the config program 998 LIBS="-L${l_usrtree}/lib" 999 CFLAGS="-nostdinc -I${l_usrtree}/include" 1000 export LIBS CFLAGS 1001 CONFIG=${l_usrtree}/sbin/config 1002 export CONFIG 1003 fi |
|
976 977 # if we have o_objdir, find where bin/ is 978 if [ ! -z "${o_objdir}" ] ; then 979 if [ -d ${o_objdir}/bin ] ; then 980 # fine 981 elif [ -d "${o_objdir}${SRC}/bin" ] ; then 982 o_objdir="${o_objdir}${SRC}" 983 log "Changing objdir to ${o_objdir}" 984 else 985 log "Cannot find objdir in ${o_objdir}, sorry" 986 o_objdir="" 987 fi 988 fi 989} 990 991#------------------------------------------------------------------- 992# Main entry of the script. Initialize variables, parse command line 993# arguments. 994 | 1004 1005 # if we have o_objdir, find where bin/ is 1006 if [ ! -z "${o_objdir}" ] ; then 1007 if [ -d ${o_objdir}/bin ] ; then 1008 # fine 1009 elif [ -d "${o_objdir}${SRC}/bin" ] ; then 1010 o_objdir="${o_objdir}${SRC}" 1011 log "Changing objdir to ${o_objdir}" 1012 else 1013 log "Cannot find objdir in ${o_objdir}, sorry" 1014 o_objdir="" 1015 fi 1016 fi 1017} 1018 1019#------------------------------------------------------------------- 1020# Main entry of the script. Initialize variables, parse command line 1021# arguments. 1022 |
1023# o_par="-j 8" # parallel make and other make options |
|
995 996set_defaults 997while [ true ]; do 998 log "Parsing $1" 999 case $1 in | 1024 1025set_defaults 1026while [ true ]; do 1027 log "Parsing $1" 1028 case $1 in |
1000 -j) 1001 o_par="-j $2" 1002 shift 1003 ;; 1004 | |
1005 --par) | 1029 --par) |
1006 o_par="-j 8" # watch out, this might be too large | 1030 o_par="-j 8" |
1007 ;; 1008 1009 --src) # set the source path instead of /usr/src 1010 SRC=`realpath $2` 1011 shift 1012 ;; 1013 1014 --init) # run a partial buildworld on the source tree --- 76 unchanged lines hidden --- | 1031 ;; 1032 1033 --src) # set the source path instead of /usr/src 1034 SRC=`realpath $2` 1035 shift 1036 ;; 1037 1038 --init) # run a partial buildworld on the source tree --- 76 unchanged lines hidden --- |