summaryrefslogtreecommitdiffstats
path: root/release
diff options
context:
space:
mode:
authorluigi <luigi@FreeBSD.org>2015-01-24 06:11:13 +0000
committerluigi <luigi@FreeBSD.org>2015-01-24 06:11:13 +0000
commit0f243342b5b0fc937b501e30de1765b84008eeed (patch)
tree4294b4bd92bf7ef38edf22f109a4668bc94e5ed1 /release
parente2d4209626034c4fa23ab8facaea8f0b7c2ed6fc (diff)
downloadFreeBSD-src-0f243342b5b0fc937b501e30de1765b84008eeed.zip
FreeBSD-src-0f243342b5b0fc937b501e30de1765b84008eeed.tar.gz
use the same version as in HEAD
(among other things, the -v flag to make is long since unsupported)
Diffstat (limited to 'release')
-rwxr-xr-xrelease/picobsd/build/picobsd206
1 files changed, 91 insertions, 115 deletions
diff --git a/release/picobsd/build/picobsd b/release/picobsd/build/picobsd
index 0d3ec19..19a9839 100755
--- a/release/picobsd/build/picobsd
+++ b/release/picobsd/build/picobsd
@@ -91,7 +91,7 @@ log() { # message
# unconditionally log and wait for input
logverbose() { # message
local foo
- printf "\n*** %s\n" "$*"
+ printf "\n*** %s\n" "$*" >&2
read -p "=== Press enter to continue" foo
return 0
}
@@ -164,12 +164,11 @@ set_defaults() { # no arguments
create_includes_and_libraries2() { # opt_dir opt_target
local no
log "create_includes_and_libraries2() for ${SRC} $1"
- if [ ${OSVERSION} -ge 600000 ] ; then
- no="-DNO_CLEAN -DNO_PROFILE -DNO_GAMES -DNO_LIBC_R" # WITHOUT_CDDL=1"
- no="$no -DWITHOUT_CLANG -DMALLOC_PRODUCTION"
- else
- no="-DNOCLEAN -DNOPROFILE -DNOGAMES -DNOLIBC_R"
- fi
+
+ no="-DNO_CLEAN -DNO_PROFILE -DNO_GAMES -DNO_LIBC_R" # WITHOUT_CDDL=1"
+ no="$no -DWITHOUT_CASPER"
+ no="$no -DMALLOC_PRODUCTION"
+
( cd ${SRC};
# make -DNOCLEAN -DNOPROFILE -DNOGAMES -DNOLIBC_R -DPICOBSD buildworld
if [ -d "$1" ] ; then
@@ -177,6 +176,7 @@ create_includes_and_libraries2() { # opt_dir opt_target
else
export MAKEOBJDIRPREFIX=${l_objtree}
make ${o_par} $no toolchain
+
# XXX do we need any of these ?
eval export `cd ${SRC}; ${BINMAKE} -f Makefile.inc1 -V WMAKEENV`
[ ${o_arch} != `uname -m` ] && \
@@ -185,48 +185,6 @@ create_includes_and_libraries2() { # opt_dir opt_target
)
}
-# entry for 4.x and earlier trees
-create_includes_and_libraries() {
- local e i
-
- log "create_includes_and_libraries() for ${SRC}"
- # Optionally creates include directory and libraries.
- mkdir -p ${l_usrtree}/include # the include directory...
- mkdir -p ${l_usrtree}/share/misc # a few things go here
- mkdir -p ${l_usrtree}/lib # libraries
- mkdir -p ${l_usrtree}/sbin # some binaries
- # override variables for ownershiip and destinations
- # BINOWN:BINGRP are also used for include files
- (cd ${SRC}; \
- BINOWN=`id -un` BINGRP=`id -gn` \
- DESTDIR=${l_usrtree}/.. \
- make -m ${SRC}/share/mk includes ) || fail $? includes
- # Pick up the correct headers for libraries.
- CFLAGS="-nostdinc -I${l_usrtree}/include" ; export CFLAGS
-
- (cd ${SRC}
- # $e is the invocation of make with correct environment
- # XXX check the NO* options below, maybe system dependent.
- e="MAKEOBJDIRPREFIX=${l_objtree}/picobsd/libraries \
- BINOWN=`id -un` BINGRP=`id -gn` \
- DESTDIR=${l_usrtree}/.. \
- make -m ${SRC}/share/mk \
- -DNOHTML -DNOINFO -DNOMAN -DNOSHARE -DNOFSCHG "
- log "do a 'make obj' in a few places."
- # This is very version-specific... The following works for 5.0
- for i in lib secure/lib gnu/lib \
- gnu/usr.bin/perl usr.bin/lex usr.sbin/config ; do
- (cd ${i}; eval $e obj)
- done
- log "now make the static libraries"
- eval $e -DNOPROFILE -DNOPIC libraries
- (cd ${SRC}/usr.sbin/config
- eval $e # build binary
- eval $e install # install it
- )
- ) || fail $? "libraries"
- log "Libraries done"
-}
# set_type <the_type> [the_site] looks in user or system directories
# for the directory named as the first argument, reads the configuration
@@ -437,7 +395,7 @@ do_kernel() { # OK
[ "${o_do_modules}" = "yes" ] && export MODULES=""
# kernel build not parallelizable yet
${BINMAKE} KERNCONF=${l_kernconf} \
- -v -f ${PICO_TREE}/build/Makefile.conf ) || \
+ -f ${PICO_TREE}/build/Makefile.conf ) || \
fail $? missing_kernel
}
@@ -570,71 +528,89 @@ do_links() { # rootdir varname
# cp -p ${u_progs} ${dst}/libexec # ignore errors
# }
+# find programs and required libraries. Accept -L libs -P path <progs>
+# if no argument default to objdir/SHLIBDIRPREFIX for both
find_progs() { # programs
- local pass i old_libs="" tmp o=""
- if [ x"$1" = "x-L" -a -d "$2" ] ; then # set lib search path
- o="-P $2"; shift; shift
- fi
- # Result returned in global variables
- u_libs="" ; u_progs="`find_progs_helper $*`"
+ # logverbose "find_progs: called with $*"
+ local i=`realpath ${o_objdir:-${_SHLIBDIRPREFIX}/..}`
+ # default values for -L and -P
+ local dir="-P $i"
+ local ldir="-L $i"
+
+ while [ "$1" != "" ] ; do
+ if [ x"$1" = "x-L" -a -d "$2" ] ; then # set lib search path
+ ldir="-L $2"; shift; shift
+ elif [ x"$1" = "x-P" -a -d "$2" ] ; then # set prog search path
+ dir="-P $2"; shift; shift
+ else
+ break
+ fi
+ done
+
+ # Results are returned in global variables
+ u_libs=""
+ u_progs="`find_progs_helper $dir $*`"
[ -z "${u_progs}" ] && return 1 # not found, error
- # use objdump to find libraries. Iterate to fetch recursive
- # dependencies.
- tmp="${u_progs}" ; pass=1
+
+ # use objdump to find libraries.
+ # Iterate to fetch recursive dependencies.
+ local tmp="${u_progs}"
+ local old_libs=""
+ local pass=1
while [ $pass -lt 10 ] ; do
pass=$(($pass + 1))
i="`objdump -x ${tmp} | \
- awk '$1 == "NEEDED" { print $2 }' | sort | uniq`"
+ awk '$1 == "NEEDED" { print $2 }' | sort | uniq | tr '\n' ' '`"
if [ "$old_libs" = "$i" ] ; then
- log "libraries for: $my_progs ($u_progs) are ($i) $u_libs"
- log "--- done find_progs ---"
+ # logverbose "find_progs: have `echo ${u_libs} | wc -w`/`echo ${i} | wc -w` libraries for: $my_progs ($u_progs)"
+ # logverbose "they are ($i) $u_libs"
return 0
else
# logverbose "old--- $old_libs --- new +++ $i +++"
fi
- u_libs="`find_progs_helper $o $i`"
+ u_libs="`find_progs_helper $ldir $i`"
old_libs="$i"
tmp="$tmp $u_libs"
done
log "WARNING: Too many passes, giving up"
}
-find_progs_helper() { # programs
- local dir=${o_objdir:-${_SHLIBDIRPREFIX}/..}
- local ldir=""
- if [ x"$1" = "x-P" -a -d "$2" ] ; then # set path
- ldir=$2; shift; shift
- fi
- local progs="$*"
- local subdirs=". local/bin local/sbin local/lib local/libexec \
- bin sbin usr.bin usr.sbin libexec lib \
- gnu/usr.bin gnu/lib \
- secure/usr.bin secure/usr.sbin secure/libexec secure/lib"
- local names="" # files to search
- local o=""
+# prints to stdout files and libs in the search paths
+find_progs_helper() { # first arg is either -P or -L
+ local ty=$1 dir=$2 ; shift; shift
+ local progs="`echo $* | tr ' ' '\n' | sort -u | tr '\n' ' '`"
+ # first, extract absolute pathnames or files in this directory
+
+ # accumulate others in $names
+ local names=""
local i
for i in $progs ; do
- # full pathnames are just listed
- [ -f "$i" ] && echo $i && continue
- names="${names} ${o} -name $i"
- o="-o"
+ [ -f "$i" ] && echo `realpath $i` && continue
+ names="${names} $i"
done
+ # if nothing left, we are done
[ -z "${names}" ] && return 0
- local places="" # places to search
- for i in $subdirs ; do
- [ -d "${dir}/${i}" ] && places="${places} ${dir}/${i}"
- done
- if [ -n "${ldir}" ] ; then
- for i in $subdirs ; do
- [ -d "${ldir}/${i}" ] && places="${places} ${ldir}/${i}"
- done
+
+ local depth p
+ local places="" # places to search
+ if [ x-P = "x$ty" ] ; then # search programs
+ depth=2
+ p=". local/bin local/sbin local/libexec \
+ bin sbin usr/bin usr/sbin libexec gnu/usr.bin \
+ secure/usr.bin secure/usr.sbin secure/libexec "
+ else
+ depth=3
+ p="lib usr/lib gnu/lib secure/lib"
fi
- for i in $progs ; do
- # full pathnames are just listed
- [ -f "$i" ] && echo $i && continue
- find ${places} -maxdepth 3 -type f -name ${i} | head -1
+ for i in $p ; do
+ i="${dir}/${i}"
+ [ -d "${i}" ] && places="${places} `realpath ${i}`"
+ done
+ # logverbose "--- looking into $places"
+ places=`echo ${places} | tr ' ' '\n' | sort -u`
+ for i in $names ; do
+ find ${places} -maxdepth $depth -type f -name ${i} | head -1
done
- # use maxdepth 3 because some libs are way down
}
# Populate the memory filesystem with binaries and non-variable
@@ -677,7 +653,7 @@ populate_mfs_tree() {
a=${BUILDDIR}/crunch1.conf
( export BUILDDIR SRC MY_TREE PICO_OBJ ;
${BINMAKE} \
- -v -f ${PICO_TREE}/build/Makefile.conf ${BUILDDIR}/crunch.mk )
+ -f ${PICO_TREE}/build/Makefile.conf ${BUILDDIR}/crunch.mk )
log "Libs are ${LIBS} "
export SRC # used by crunch.mk
# export LIBS CFLAGS
@@ -746,6 +722,7 @@ populate_mfs_tree() {
fi
log "for a shared 'crunch' take libraries and dynamic loader as well"
+ # /stand/crunch is our main binary, we extract its libs
find_progs ${dst}/stand/crunch
if [ -n "${u_libs}" ] ; then
mkdir -p ${dst}/lib && cp -p ${u_libs} ${dst}/lib
@@ -881,7 +858,7 @@ fill_floppy_image() {
else
log "not loading mfs, size ${mfs_size} img ${imgsize}"
fi
- log "Compress with kgzip and copy to floppy image"
+ log "Compress with gzip and copy to floppy image"
mkdir -p ${dst}/boot/kernel
# XXX loader.conf does not work unless we also load the .4th files
@@ -944,11 +921,11 @@ fill_floppy_image() {
dd of=${BUILDDIR}/${c_img} oseek=1 obs=788 conv=notrunc 2>/dev/null
log "done disk image"
# XXX (log "Fixing permissions"; cd ${dst}; chown -R root *)
+ df -ik ${dst} | colrm 70 > .build.reply
# leave build stuff if verbose
[ ${o_verbose} -gt 0 ] && return
rm -rf ${BUILDDIR}/floppy.tree || true # cleanup
- # df -ik ${dst} | colrm 70 > .build.reply
rm -rf ${dst}
rm ${BUILDDIR}/${c_fs}
# rm ${BUILDDIR}/kernel.gz
@@ -971,36 +948,31 @@ set_build_parameters() {
set `grep "#define[\t ]__FreeBSD_version" ${SRC}/sys/sys/param.h`
OSVERSION=$3
log "OSVERSION is ${OSVERSION}"
- if [ ${OSVERSION} -ge 500035 ] ; then
+
export MAKEOBJDIRPREFIX=${l_objtree}
export TARGET_ARCH=${o_arch} TARGET=${o_arch}
- export WITHOUT_CLANG_IS_CC=1
+ # XXX 20131001 see if CLANG fixes the build
+ export WITHOUT_CLANG_IS_CC=yes
+ export WITHOUT_CLANG_BOOTSTRAP=yes
+ export WITH_GCC=yes
+ export WITH_GCC_BOOTSTRAP=yes
+ export WITH_GNUCXX=yes
+ export WITHOUT_CLANG=yes
+ export WITHOUT_ICONV=yes
+
# XXX why change machine_arch ?
#-- export MACHINE_ARCH=`uname -m` MACHINE=`uname -m`
# export CWARNFLAGS="-Wextra -Wno-sign-compare -Wno-missing-field-initializers"
+ # XXX BINMAKE does not really exist anymore
eval "export BINMAKE=\"`cd ${SRC}; make -f Makefile -V BINMAKE`\""
[ "$BINMAKE" = "" ] && \
eval "export BINMAKE=\"`cd ${SRC}; make -f Makefile -V SUB_MAKE`\""
- fi
if [ "${o_init_src}" != "" ] ; then
- if [ ${OSVERSION} -lt 500035 ] ; then
- create_includes_and_libraries
- else
- create_includes_and_libraries2
- fi
+ create_includes_and_libraries2
else
eval export `cd ${SRC}; ${BINMAKE} -f Makefile.inc1 -V WMAKEENV`
fi
- if [ ${OSVERSION} -lt 500035 ] ; then
- # Create the right LIBS and CFLAGS for further builds.
- # and build the config program
- LIBS="-L${l_usrtree}/lib"
- CFLAGS="-nostdinc -I${l_usrtree}/include"
- export LIBS CFLAGS
- CONFIG=${l_usrtree}/sbin/config
- export CONFIG
- fi
# if we have o_objdir, find where bin/ is
if [ ! -z "${o_objdir}" ] ; then
@@ -1020,14 +992,18 @@ set_build_parameters() {
# Main entry of the script. Initialize variables, parse command line
# arguments.
-# o_par="-j 8" # parallel make and other make options
set_defaults
while [ true ]; do
log "Parsing $1"
case $1 in
+ -j)
+ o_par="-j $2"
+ shift
+ ;;
+
--par)
- o_par="-j 8"
+ o_par="-j 8" # watch out, this might be too large
;;
--src) # set the source path instead of /usr/src
OpenPOWER on IntegriCloud