OpenSDE Framework (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

423 lines
12 KiB

# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: lib/sde-config/main.in
# Copyright (C) 2006 - 2013 The OpenSDE Project
# Copyright (C) 2004 - 2006 The T2 SDE Project
# Copyright (C) 1998 - 2003 Clifford Wolf
#
# More information can be found in the files COPYING and README.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License. A copy of the
# GNU General Public License can be found in the file COPYING.
# --- SDE-COPYRIGHT-NOTE-END ---
#
# Main config script
#
# Execution of sub-scripts:
#
# - architecture/*/preconfig.in
#
# - lib/*/preconfig.in
# - target/*/preconfig.in
# - package/*/*/preconfig.in
#
# * Selecting Target
# * target/$SDECFG_TARGET/config.in
# - target/$SDECFG_TARGET/inconfig.in
#
# * Selecting Architecture
# * architecture/$SDECFG_ARCH/config.in
#
# - target/$SDECFG_TARGET/pkgsel{,.sed,.awk,.in}
#
# * {package/*,misc,lib}/*/config-n.in (n<500)
#
# * {package/*,misc,lib}/*/config{,-n}.in (n>=500)
# * Various common build options
#
# - package/*/*/postconfig.in
# - lib/*/postconfig.in
# - architecture/$SDECFG_ARCH/postconfig.in
# - target/$SDECFG_TARGET/postconfig.in
#
# Only procedures marked with '*' might interact with the user.
#
# Naming-scheme for extening config variables:
#
# Core: SDECFG_*
# Archs: SDECFG_ARCH_<Arch-Name>_*
# Targets: SDECFG_TRG_<Target-Name>_*
# Packages: SDECFG_PKG_<Pkg-Name>_*
#
# Config-Internal Variables:
#
# Core: CFGTEMP_*
# Archs: CFGTEMP_ARCH_<Arch-Name>_*
# Targets: CFGTEMP_TRG_<Target-Name>_*
# Packages: CFGTEMP_PKG_<Pkg-Name>_*
#
# Config Presets: SDECFGSET_*
#
CFGTEMP_ARCHLIST=
CFGTEMP_TARGETLIST=
CFGTEMP_IMAGELIST=
. $cfgtmpdir/misc-preconfig.in
. $cfgtmpdir/lib-preconfig.in
. $cfgtmpdir/target-preconfig.in
. $cfgtmpdir/package-preconfig.in
comment_id '- Target Distribution' COMMENT_TARGET
block_begin 7
choice SDECFG_TARGET generic $CFGTEMP_TARGETLIST
SDECFG_ID="$SDECFG_ID-$SDECFG_TARGET"
# detect the target chain
targetchain="$SDECFG_TARGET"; x="$SDECFG_TARGET"
while [ -f "target/$x/extends" ]; do
x="`cat target/$x/extends`"
targetchain="$targetchain $x"
done
# config.in it foreward order
for target in $targetchain; do
if [ -f target/$target/config.in ]
then . target/$target/config.in ; fi
done
for target in $( get_reverted $targetchain ); do
if [ -f target/$target/inconfig.in ]
then . target/$target/inconfig.in ; fi
done
if [ "$CFGTEMP_IMAGELIST" ]; then
choice SDECFG_IMAGE none $CFGTEMP_IMAGELIST
if [ -f target/share/$SDECFG_IMAGE/config.in ]; then
. target/share/$SDECFG_IMAGE/config.in
fi
fi
block_end
. $cfgtmpdir/architecture-preconfig.in
comment ' '
comment_id '- Architecture, CPU and Optimization' COMMENT_ARCHCPUOPT
block_begin 7
choice SDECFG_ARCH $SDECFG_ARCH $CFGTEMP_ARCHLIST
SDECFG_ID="$SDECFG_ID-$SDECFG_ARCH"
if [ -f architecture/$SDECFG_ARCH/config.in ]
then . architecture/$SDECFG_ARCH/config.in ; fi
case $SDECFG_ARCH in
mips64|powerpc64|sparc64|x86-64)
bool 'Enable c-compiler multilib support' \
SDECFG_MULTILIB 0
;;
esac
bool 'This is a cross-build between architectures' SDECFG_CROSSBUILD 0
if [ "$SDECFG_CROSSBUILD" = 1 ] ; then
pkgfilter sed -e 's,^\(. ..\)[^ ]*,\1--------,' -e 's,^\(. \)?,\10,' -e 's,^\(. .\)?,\11,'
SDECFG_ID="$SDECFG_ID-cross" ; SDECFGSET_USE_CROSSCC=1
else
pkgfilter sed -e 's,^\(. \)?,\1-,' -e 's,^\(. .\)?,\1-,'
fi
block_end
block_begin 7
# pkgsel in backward order
for target in $( get_reverted $targetchain ); do
if [ -f target/$target/pkgsel ]; then
if [ target/$target/pkgsel -nt $cfgtmpdir/pkgsel.$target.awk ]
then
cat <<-EOT > $cfgtmpdir/pkgsel.$target.awk
# created from target/$target/pkgsel
#
EOT
lib/sde-config/pkgsel2awk.sh \
target/$target/pkgsel >> $cfgtmpdir/pkgsel.$target.awk
fi
if [ -s $cfgtmpdir/pkgsel.$target.awk ]; then
pkgfilter awk -f $cfgtmpdir/pkgsel.$target.awk
[ "$SDECFG_LICENSE_ISSUE" = 0 ] && pkgchecklicense
else
comment 'WARNING! something went wrong with target-pkgsel'
fi
elif [ -f target/$target/pkgsel.awk ]; then
pkgfilter awk -f target/$target/pkgsel.awk
[ "$SDECFG_LICENSE_ISSUE" = 0 ] && pkgchecklicense
elif [ -f target/$target/pkgsel.sed ]; then
pkgfilter sed -f target/$target/pkgsel.sed
[ "$SDECFG_LICENSE_ISSUE" = 0 ] && pkgchecklicense
elif [ -f target/$target/pkgsel.in ]; then
. target/$target/pkgsel.in
[ "$SDECFG_LICENSE_ISSUE" = 0 ] && pkgchecklicense
fi
done
block_end
if test -f $cfgtmpdir/license-issue.ask; then
comment ' '
comment_id '- Licensing issues' COMMENT_LICENSE
block_begin 7
if [ "$SDECFG_LICENSE_ISSUE" != 1 ]; then
comment ' This distribution may contain software that is not publicly'
comment ' distributable. Please check the following to testify that you'
comment ' are aware of this fact.'
comment ' '
comment ' The following packages may contain such restrictive licenses:'
for i in `cat $cfgtmpdir/license-issue.ask`; do
comment " $i"
done
comment ' '
fi
bool 'I have read and understood the licensing issues.' SDECFG_LICENSE_ISSUE 0
block_end
fi
comment ' '
comment_id '- Build System Configuration' COMMENT_BUILD_SYS_CONF
block_begin 3
choice SDECFG_CONTINUE_ON_ERROR_AFTER 4 \
0 'Continue if package-build fails after toolchain (native)' \
1 'Continue if package-build fails after toolchain (cross)' \
2 'Continue if package-build fails after stage 2' \
3 'Continue if package-build fails after stage 3' \
4 'Continue if package-build fails after stage 4' \
5 'Continue if package-build fails after stage 5' \
6 'Continue if package-build fails after stage 6' \
7 'Continue if package-build fails after stage 7' \
8 'Continue if package-build fails on rebuild stage' \
9 'Always abort if package-build fails'
bool 'Retry building broken packages' SDECFG_RETRY_BROKEN 0
bool 'Do not try building packages if deps failed' \
SDECFG_NOBROKENDEPS 0
bool 'Always clean up src dirs (even on pkg fail)' \
SDECFG_ALWAYS_CLEAN 0
bool 'Create debug information (xtrace) for builds' SDECFG_XTRACE 0
bool 'Use TMPFS for building packages' SDECFG_SRC_TMPFS 0
if [ "$SDECFG_SRC_TMPFS" = 1 ] ; then
block_begin
comment '! WARNING: This feature can hang your system, if'
comment '! you do not have enough virtual memory!'
text 'TMPFS mount options' SDECFG_SRC_TMPFS_OPT \
'size=800M,nr_inodes=100k'
bool 'Write tmpfs log to var/adm/sde-debug/tmpfslog.txt' \
SDECFG_SRC_TMPFS_LOG 0
block_end
fi
block_end
# Apply custom package selection
if [ "$SDECFG_PKGSEL" = 1 -a -f $cfgtmpdir/config/pkgsel ] ; then
# Active error checking: explicitly show an annoying popup
filter=`printf "^[-xXoO][ \t]\+[a-zA-Z0-9_/*+.-]"`
if grep -lvq "$filter" $cfgtmpdir/config/pkgsel 2> /dev/null; then
if [ -n "$oldconfig" ]; then
echo "Invalid line(s) in package rule set will be removed"
grep -nv "$filter" $cfgtmpdir/config/pkgsel
grep "$filter" $cfgtmpdir/config/pkgsel \
> $cfgtmpdir/pkgsel.new
mv $cfgtmpdir/pkgsel.new $cfgtmpdir/config/pkgsel
elif ./tmp/confdialog.bin --title "Build Config" --yesno \
"Invalid line(s) in package rule set. Remove?" 5 50
then
grep "$filter" $cfgtmpdir/config/pkgsel \
> $cfgtmpdir/pkgsel.new
mv $cfgtmpdir/pkgsel.new $cfgtmpdir/config/pkgsel
fi
fi
unset filter
cat <<-EOT > $cfgtmpdir/pkgsel.awk
# created from config/$config/pkgsel
#
EOT
lib/sde-config/pkgsel2awk.sh \
$cfgtmpdir/config/pkgsel >> $cfgtmpdir/pkgsel.awk
pkgout
gawk -f $cfgtmpdir/pkgsel.awk < $cfgtmpdir/config/packages \
> $cfgtmpdir/packages.new 2> /dev/null
if [ -s $cfgtmpdir/packages.new ] ; then
mv $cfgtmpdir/packages.new $cfgtmpdir/config/packages
else
rm -f $cfgtmpdir/packages.new
CFGTEMP_PKSEL_ERROR=1
fi
pkgin
fi
comment ' '
if [ -d /sys/devices/ ]; then
cpus=`ls -1d /sys/devices/system/cpu/cpu[0-9]*/ | wc -l`
else
cpus=`grep '^processor[[:blank:]]:' /proc/cpuinfo | wc -l`
fi
cpus=${cpus:-1}
SDECFG_PARALLEL_MAX="`echo $SDECFG_PARALLEL_MAX | sed 's,[^0-9],,g'`"
text "Maximum number of jobs to be executed in parallel ($cpus CPUs)" \
SDECFG_PARALLEL_MAX $( expr $cpus \* 2 )
unset cpus
comment ' '
block_begin 3
# this is warranted to exist
. $cfgtmpdir/noexpert-config.in
block_end
comment ' '
block_begin 3
bool 'Show expert and experimental options' SDECFG_EXPERT 0
block_end
expert_begin
. $cfgtmpdir/cache_pkgfile_type.in
comment ' '
comment '- Additional Package Selection'
block_begin 3
bool 'Custom package selection' SDECFG_PKGSEL 0
if [ "$SDECFG_PKGSEL" = 1 ] ; then
menu_begin MENU_PKGSEL_RULES 'Edit package selection rules'
editfile SDECFG_PKGSEL_FILE $cfgtmpdir/config/pkgsel \
'Package selection rules'
if [ "$CFGTEMP_PKGSEL_ERROR" = 1 ]; then
comment '---- Syntax error(s) in rule set!'
fi
[ "$SDECFG_LICENSE_ISSUE" = 0 ] && pkgchecklicense
menu_end
else
rm -f $cfgtmpdir/config/pkgsel $cfgtmpdir/pkgsel.awk
fi
startprog SDECFG_SHOW_PKGLIST 'Show the current package list' \
"./tmp/confdialog.bin --title 'OpenSDE Config - Package List' \
--backtitle 'OpenSDE ($sdever) Configuration' \
--textbox $cfgtmpdir/packages.txt \
$(( $lines - 4 )) $(( $columns - 5 ))"
block_end
comment ' '
# this is warranted to exist
. $cfgtmpdir/expert-config.in
comment ' '
comment '- Additional GNU Configure Options'
block_begin 5
editfile SDECFG_CONFOPT_FILE $cfgtmpdir/config/confopt \
'GNU Configure Options'
if [ -f $cfgtmpdir/config/confopt ] ; then
const SDECFG_CONFIGURE_OPTS "`tr '\n' ' ' \
< $cfgtmpdir/config/confopt`"
else
const SDECFG_CONFIGURE_OPTS ""
fi
for option in $SDECFG_CONFIGURE_OPTS ; do
if [ "${option#--with-}" = "$option" -a \
"${option#--without-}" = "$option" ]
then
comment '---- Warning! The custom options may
break packages!'
break
fi
done
block_end
comment ' '
text 'Additional compiler flags' SDECFG_C_FLAGS ""
comment ' '
comment_id '- Flist detection technique' COMMENT_FLIST
block_begin 5
choice SDECFG_FLIST flwrapper \
flwrapper 'Use the flist wrapper library for flist creation' \
strace 'Use strace to get the file list' \
find 'Use find on timestamp-file for flist creation'
block_end
comment ' '
comment '- Various Options'
block_begin 5
bool 'Bootstrap a new, clean and up-to-date toolchain' SDECFG_USE_CROSSCC 1
bool 'Make rebuild stage (stage 9)' SDECFG_DO_REBUILD_STAGE 0
if [ $SDECFG_CROSSBUILD != 1 ]; then
bool 'Run a check/test for packages with support' SDECFG_DO_CHECK 0
fi
if [ $SDECFG_USE_CROSSCC != 1 ]; then
pkgfilter sed 's,^\([XO] \)0,\1-,'
fi
if [ $SDECFG_DO_REBUILD_STAGE != 1 ]; then
pkgfilter sed 's,^\([XO] [0-8-]*\)9 ,\1- ,'
fi
choice SDECFG_OPT speed \
speed 'Hard optimise for speed (recommended)' \
size 'Hard optimise for size (sometimes faster)' \
lazy 'Lazy optimisation (debugging and fast building)'
bool 'Create binaries with debug symbols' SDECFG_DEBUG 0
if [ $SDECFG_DEBUG = 1 ]; then
bool 'Split debug symbols into separate debug info files' SDECFG_DEBUG_SPLIT 0
fi
bool 'Create statically linked binaries' SDECFG_STATIC 0
bool 'Enable ld --as-needed' SDECFG_LD_AS_NEEDED 0
bool 'Enable PIE (Position Independent Code)' SDECFG_PIE 0
bool 'Disable exceptions and rtti in C++' SDECFG_LIMITCXX 0
bool 'Disable National Language Support' SDECFG_DISABLE_NLS 0
bool 'Automatic documentation creation' SDECFG_CREATE_DOCS 0
bool 'Create cache files after packages have been built' \
SDECFG_CREATE_CACHE 1
bool 'Run Paranoia Checks in Build-Target and Build-Pkg' \
SDECFG_PARANOIA_CHECK 1
bool 'Abbreviate Config ID with checksum' SDECFG_IDCKSUM 0
block_end
expert_end
. $cfgtmpdir/package-postconfig.in
. $cfgtmpdir/misc-postconfig.in
. $cfgtmpdir/lib-postconfig.in
. $cfgtmpdir/architecture-postconfig.in
. $cfgtmpdir/target-postconfig.in
pkgfilter sed '/^[XO] --* / d;'
[ $SDECFG_EXPERT = 1 ] ||
SDECFG_ID="`echo $SDECFG_ID | sed 's,-noexpert.*,,'`"
[ "$SDECFG_IDCKSUM" = 1 ] &&
SDECFG_ID="`echo $SDECFG_ID | cksum | cut -f1 -d' '`"
const SDECFG_SHORTID "$SDECFG_ID"
SDECFG_ID="$config-$SDECFG_ID"