summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbuild28
-rw-r--r--include/git.sh31
-rw-r--r--include/lib.sh16
-rw-r--r--include/rom.sh34
-rw-r--r--include/vendor.sh83
-rwxr-xr-xscript/trees58
6 files changed, 83 insertions, 167 deletions
diff --git a/build b/build
index 09c908c5..ffed6708 100755
--- a/build
+++ b/build
@@ -27,7 +27,7 @@ main()
for g in "which git" "git config --global user.name" \
"git config --global user.email" "git_init"; do
- eval "$g 1>/dev/null 2>/dev/null || git_err \"$g\""
+ eval "$g 1>/dev/null 2>/dev/null || $err \"Unconfigured: $g\""
done
case "${spath#script/}" in
@@ -37,14 +37,13 @@ main()
download) shift 1; vendor_download $@ ;;
roms)
if [ $# -gt 1 ] && [ "$2" = "serprog" ]; then
- x_ ./update trees -b stm32-vserprog
- x_ ./update trees -b pico-serprog; return 0
+ x_ ./mk -b stm32-vserprog
+ x_ ./mk -b pico-serprog; return 0
fi; shift 1
- x_ ./update trees -b coreboot $@ ;;
+ x_ ./mk -b coreboot $@ ;;
*)
- echo "'$@'"
[ -f "$spath" ] || $err "bad command"
- $shcmd; "$spath" $@ || $err "excmd: $spath $@" ;;
+ $shcmd; "$spath" $@ || $err "excmd: $spath $(echo "$@")" ;;
esac
set -u -e # some commands disable them. turn them on!
}
@@ -62,12 +61,6 @@ git_init()
git tag -a "$version" -m "$projectname $version" || return 1
}
-git_err()
-{
- printf "You need to set git name/email, like so:\n%s\n\n" "$1" 1>&2
- $err "Git name/email not configured"
-}
-
mkrelease()
{
export XBMK_RELEASE="y"
@@ -100,9 +93,7 @@ build_release()
{
(
cd "$srcdir" || $err "$vdir: !cd \"$srcdir\""
- ./update trees -f
- rmgit .
- x_ rm -Rf tmp
+ ./mk -f; x_ rm -Rf tmp; rmgit .
x_ mv src/docs docs
) || $err "can't create release files"
@@ -117,12 +108,11 @@ build_release()
[ "$mode" = "src" ] && return 0
touch "$srcdir/lock" || $err "can't make lock file in $srcdir/"
-
(
cd "$srcdir" || $err "$vdir: 2 !cd \"$srcdir\""
- ./update trees -b coreboot || $err "$vdir: roms-all"
- ./update trees -b pico-serprog || $err "$vdir: rp2040"
- ./update trees -b stm32-vserprog || $err "$vdir: stm32"
+ ./mk -b coreboot || $err "$vdir: roms-all"
+ ./mk -b pico-serprog || $err "$vdir: rp2040"
+ ./mk -b stm32-vserprog || $err "$vdir: stm32"
x_ mv bin ../roms
) || $err "can't build rom images"
diff --git a/include/git.sh b/include/git.sh
index f8441f33..8c86b4c2 100644
--- a/include/git.sh
+++ b/include/git.sh
@@ -8,7 +8,7 @@ eval `setvars "" loc url bkup_url subfile subhash subrepo subrepo_bkup \
fetch_targets()
{
[ -n "$tree_depend" ] && [ "$tree_depend" != "$tree" ] && \
- x_ ./update trees -f "$project" "$tree_depend"
+ x_ ./mk -f "$project" "$tree_depend"
e "src/$project/$tree" d && return 0
printf "Creating %s tree %s\n" "$project" "$tree"
@@ -23,10 +23,10 @@ fetch_project()
chkvars url
- [ -n "$xtree" ] && x_ ./update trees -f coreboot "$xtree"
+ [ -n "$xtree" ] && x_ ./mk -f coreboot "$xtree"
[ -z "$depend" ] || for d in $depend ; do
printf "'%s' needs '%s'; grabbing '%s'\n" "$project" "$d" "$d"
- x_ ./update trees -f $d
+ x_ ./mk -f $d
done
clone_project
@@ -39,32 +39,24 @@ clone_project()
{
loc="$XBMK_CACHE/repo/$project" && singletree "$project" && \
loc="src/$project"
-
printf "Downloading project '%s' to '%s'\n" "$project" "$loc"
- e "$loc" d && return 0
- remkdir "${tmpgit%/*}"
- git_prep "$url" "$bkup_url" "$PWD/config/$project/patches" "$loc"
+ e "$loc" d missing && remkdir "${tmpgit%/*}" && git_prep \
+ "$url" "$bkup_url" "$PWD/config/$project/patches" "$loc"; :
}
git_prep()
{
- _patchdir="$3" # $1 and $2 are gitrepo and gitrepo_backup
- _loc="$4"
-
- chkvars rev
+ _patchdir="$3"; _loc="$4" # $1 and $2 are gitrepo and gitrepo_backup
- tmpclone "$1" "$2" "$tmpgit" "$rev" "$_patchdir"
+ chkvars rev; tmpclone "$1" "$2" "$tmpgit" "$rev" "$_patchdir"
if singletree "$project" || [ $# -gt 4 ]; then
- prep_submodules "$_loc"
- fi
+ prep_submodules "$_loc"; fi
[ "$project" = "coreboot" ] && [ -n "$xtree" ] && [ $# -gt 2 ] && \
[ "$xtree" != "$tree" ] && link_crossgcc "$_loc"
-
[ "$XBMK_RELEASE" = "y" ] && \
- [ "$_loc" != "$XBMK_CACHE/repo/$project" ] && \
- rmgit "$tmpgit"
+ [ "$_loc" != "$XBMK_CACHE/repo/$project" ] && rmgit "$tmpgit"
move_repo "$_loc"
}
@@ -87,7 +79,6 @@ fetch_submodule()
_seval="if [ -n \"\$sub$xt\" ] || [ -n \"\$sub${xt}_bkup\" ]"
eval "$_seval; then st=\"\$st \$xt\"; fi"
done
-
st="${st# }" && [ "$st" = "repo file" ] && $err "$mdir: repo+file"
[ -z "$st" ] && return 0 # subrepo/subfile not defined
@@ -103,12 +94,12 @@ fetch_submodule()
tmpclone()
{
[ "$repofail" = "y" ] && \
- printf "Cached clone failed; trying online.\n" 1>&2
- repofail="n"
+ printf "Cached clone failed; trying online.\n" 1>&2; repofail="n"
[ $# -lt 6 ] || rm -Rf "$3" || $err "git retry: !rm $3 ($1)"
repodir="$XBMK_CACHE/repo/${1##*/}" && [ $# -gt 5 ] && repodir="$3"
mkdir -p "$XBMK_CACHE/repo" || $err "!rmdir $XBMK_CACHE/repo"
+
if [ -d "$repodir" ] && [ $# -lt 6 ]; then
git -C "$repodir" pull || sleep 3 || git -C "$repodir" pull \
|| sleep 3 || git -C "$repodir" pull || :
diff --git a/include/lib.sh b/include/lib.sh
index 2cd8c0d7..586ecde1 100644
--- a/include/lib.sh
+++ b/include/lib.sh
@@ -7,8 +7,6 @@ export LC_COLLATE=C
export LC_ALL=C
_ua="Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Firefox/91.0"
-kbnotice="Insert a .gkb file from config/data/grub/keymap/ as keymap.gkb \
-if you want a custom keymap in GRUB; use cbfstool from elf/cbfstool."
ifdtool="elf/ifdtool/default/ifdtool"
cbfstool="elf/cbfstool/default/cbfstool"
@@ -58,8 +56,7 @@ e()
estr="[ -$es_t \"\$1\" ] || return 1"
[ $# -gt 2 ] && estr="[ -$es_t \"\$1\" ] && return 1" && es2="missing"
- eval "$estr"
- printf "%s %s\n" "$1" "$es2" 1>&2
+ eval "$estr"; printf "%s %s\n" "$1" "$es2" 1>&2
}
install_packages()
@@ -121,8 +118,7 @@ versiondate_="$versiondate"
[ ! -e ".git" ] || versiondate="$(git show --no-patch --no-notes \
--pretty='%ct' HEAD)" || versiondate="$versiondate_"
for p in projectname version versiondate projectsite; do
- chkvars "$p"
- eval "x_ printf \"%s\\n\" \"\$$p\" > $p"
+ chkvars "$p"; eval "x_ printf \"%s\\n\" \"\$$p\" > $p"
done
relname="$projectname-$version"
export LOCALVERSION="-$projectname-${version%%-*}"
@@ -147,8 +143,7 @@ mkrom_tarball()
printf "%s\n" "$versiondate" > "$1/versiondate" || $err "$1 !vdate"
printf "%s\n" "$projectname" > "$1/projectname" || $err "$1 !pname"
- mktarball "$1" "${1%/*}/${relname}_${1##*/}.tar.xz"
- x_ rm -Rf "$1"
+ mktarball "$1" "${1%/*}/${relname}_${1##*/}.tar.xz"; x_ rm -Rf "$1"; :
}
mktarball()
@@ -182,7 +177,7 @@ rmgit()
singletree()
{
for targetfile in "config/${1}/"*/target.cfg; do
- [ -e "$targetfile" ] && [ -f "$targetfile" ] && return 1
+ [ -e "$targetfile" ] && [ -f "$targetfile" ] && return 1; :
done; return 0
}
@@ -208,8 +203,7 @@ download()
vendor_checksum()
{
[ "$(sha512sum "$2" | awk '{print $1}')" != "$1" ] || return 1
- printf "Bad checksum for file: %s\n" "$2" 1>&2
- rm -f "$2" || :
+ printf "Bad checksum for file: %s\n" "$2" 1>&2; rm -f "$2" || :; :
}
cbfs()
diff --git a/include/rom.sh b/include/rom.sh
index 8e33a564..80643c48 100644
--- a/include/rom.sh
+++ b/include/rom.sh
@@ -28,10 +28,8 @@ mkpayload_grub()
{
eval `setvars "" grub_modules grub_install_modules`
$dry eval `setcfg "$grubdata/module/$tree"`
-
- $dry x_ rm -f "$srcdir/grub.elf"
-
- $dry "$srcdir/grub-mkstandalone" --grub-mkimage="$srcdir/grub-mkimage" \
+ $dry x_ rm -f "$srcdir/grub.elf"; $dry \
+ "$srcdir/grub-mkstandalone" --grub-mkimage="$srcdir/grub-mkimage" \
-O i386-coreboot -o "$srcdir/grub.elf" -d "${srcdir}/grub-core/" \
--fonts= --themes= --locales= --modules="$grub_modules" \
--install-modules="$grub_install_modules" \
@@ -79,15 +77,10 @@ check_coreboot_utils()
mkcorebootbin()
{
- $dry realmkcorebootbin; :
-}
-
-realmkcorebootbin()
-{
[ "$target" = "$tree" ] && return 0
tmprom="$TMPDIR/coreboot.rom"
- mv "$srcdir/build/coreboot.rom" "$tmprom" || $err "!mktmprom"
+ $dry x_ cp "$srcdir/build/coreboot.rom" "$tmprom"
initmode="${defconfig##*/}"; displaymode="${initmode##*_}"
initmode="${initmode%%_*}"
@@ -107,12 +100,12 @@ realmkcorebootbin()
[ "$payload_memtest" = "y" ] || payload_memtest="n"
[ "$(uname -m)" = "x86_64" ] || payload_memtest="n"
- if grep "CONFIG_PAYLOAD_NONE=y" "$defconfig"; then
+ if $dry grep "CONFIG_PAYLOAD_NONE=y" "$defconfig"; then
[ "$payload_seabios" = "y" ] && pname="seabios" && \
$dry add_seabios
[ "$payload_uboot" = "y" ] && pname="uboot" && $dry add_uboot
else
- pname="custom" && cprom; :
+ pname="custom" && $dry cprom; :
fi; :
}
@@ -149,10 +142,8 @@ mkseagrub()
{
cbfs "$tmprom" "$grubdata/bootorder" bootorder raw
for keymap in config/data/grub/keymap/*.gkb; do
- [ -f "$keymap" ] || continue
- keymap="${keymap##*/}"
- cprom "${keymap%.gkb}"
- done
+ [ -f "$keymap" ] && cprom "${keymap##*/}"; :
+ done; :
}
add_uboot()
@@ -168,11 +159,11 @@ add_uboot()
cprom()
{
newrom="bin/$target/${pname}_${target}_$initmode$displaymode.rom"
- [ $# -gt 0 ] && newrom="${newrom%.rom}_$1.rom"
+ [ $# -gt 0 ] && newrom="${newrom%.rom}_${1%.gkb}.rom"
x_ mkdir -p "bin/$target"
x_ cp "$tmprom" "$newrom" && [ $# -gt 0 ] && \
- cbfs "$newrom" "config/data/grub/keymap/$1.gkb" keymap.gkb raw
+ cbfs "$newrom" "config/data/grub/keymap/$1" keymap.gkb raw
[ "$XBMK_RELEASE" = "y" ] || return 0
$dry mksha512sum "$newrom" "vendorhashes"; $dry ./vendor inject \
@@ -181,11 +172,6 @@ cprom()
mkcoreboottar()
{
- $dry realmkcoreboottar
-}
-
-realmkcoreboottar()
-{
[ "$target" = "$tree" ] && return 0; [ "$XBMK_RELEASE" = "y" ] && \
- [ "$release" != "n" ] && $dry mkrom_tarball "bin/$target"; return 0
+ [ "$release" != "n" ] && $dry mkrom_tarball "bin/$target"; :
}
diff --git a/include/vendor.sh b/include/vendor.sh
index ace3f7ce..a6e82271 100644
--- a/include/vendor.sh
+++ b/include/vendor.sh
@@ -25,10 +25,8 @@ eval `setvars "" EC_url_bkup EC_hash DL_hash DL_url_bkup MRC_refcode_gbe vcfg \
vendor_download()
{
- export PATH="$PATH:/sbin"
-
- [ $# -gt 0 ] || $err "No argument given"
- board="$1" && readcfg && readkconfig && bootstrap && getfiles; return 0
+ [ $# -gt 0 ] || $err "No argument given"; export PATH="$PATH:/sbin"
+ board="$1"; readcfg && readkconfig && bootstrap && getfiles; :
}
readkconfig()
@@ -49,14 +47,14 @@ readkconfig()
bootstrap()
{
- x_ ./update trees -f coreboot ${cbdir##*/}
+ x_ ./mk -f coreboot ${cbdir##*/}
for d in uefitool biosutilities bios_extract; do
- x_ ./update trees -b "$d"
+ x_ ./mk -b "$d"
done
[ -d "${kbc1126_ec_dump%/*}" ] && x_ make -C "$cbdir/util/kbc1126"
[ -n "$MRC_refcode_cbtree" ] && \
cbfstoolref="elf/cbfstool/$MRC_refcode_cbtree/cbfstool" && \
- x_ ./update trees -d coreboot $MRC_refcode_cbtree; return 0
+ x_ ./mk -d coreboot $MRC_refcode_cbtree; return 0
}
getfiles()
@@ -68,9 +66,8 @@ getfiles()
"$CONFIG_SMSC_SCH5545_EC_FW_FILE"
[ -z "$CONFIG_KBC1126_FIRMWARE" ] || fetch kbc1126ec "$EC_url" \
"$EC_url_bkup" "$EC_hash" "$CONFIG_KBC1126_FW1"
- [ -z "$CONFIG_VGA_BIOS_FILE" ] || fetch "e6400vga" \
- "$E6400_VGA_DL_url" "$E6400_VGA_DL_url_bkup" "$E6400_VGA_DL_hash" \
- "$CONFIG_VGA_BIOS_FILE"
+ [ -z "$CONFIG_VGA_BIOS_FILE" ] || fetch e6400vga "$E6400_VGA_DL_url" \
+ "$E6400_VGA_DL_url_bkup" "$E6400_VGA_DL_hash" "$CONFIG_VGA_BIOS_FILE"
[ -z "$CONFIG_HAVE_MRC" ] || fetch "mrc" "$MRC_url" "$MRC_url_bkup" \
"$MRC_hash" "$CONFIG_MRC_FILE"; return 0
}
@@ -82,33 +79,27 @@ fetch()
download "$dl" "$dl_bkup" "$_dl" "$dlsum"
- rm -Rf "${_dl}_extracted" || \
- $err "!rm -Rf ${_ul}_extracted"
+ rm -Rf "${_dl}_extracted" || $err "!rm -Rf ${_ul}_extracted"
e "$_dest" f && return 0
mkdir -p "${_dest%/*}" || $err "mkdirs: !mkdir -p ${_dest%/*}"
- remkdir "$appdir"
- extract_archive "$_dl" "$appdir" || [ "$dl_type" = "e6400vga" ] || \
- $err "mkdirs $_dest $dl_type: !extract"
-
- eval "extract_$dl_type"
- set -u -e
+ remkdir "$appdir"; extract_archive "$_dl" "$appdir" || \
+ [ "$dl_type" = "e6400vga" ] || $err "mkd $_dest $dl_type: !extract"
- e "$_dest" f missing && $err "!extract_$dl_type"; return 0
+ eval "extract_$dl_type"; set -u -e
+ e "$_dest" f missing && $err "!extract_$dl_type"; :
}
extract_intel_me()
{
e "$mecleaner" f not && $err "$cbdir: me_cleaner missing"
- _me="$PWD/$_dest" # must always be an absolute path
- cdir="$PWD/$appdir" # must always be an absolute path
+ _me="$PWD/$_dest"; cdir="$PWD/$appdir"
[ $# -gt 0 ] && _me="${1}" && cdir="$2"
e "$_me" f && return 0
- sdir="$(mktemp -d)"
- [ -z "$sdir" ] && return 0
+ sdir="$(mktemp -d)"; [ -z "$sdir" ] && return 0
mkdir -p "$sdir" || $err "extract_intel_me: !mkdir -p \"$sdir\""
set +u +e
@@ -131,8 +122,7 @@ extract_intel_me()
else
continue
fi
- cdir="$1"
- [ "${cdir#/a}" != "$cdir" ] && cdir="${cdir#/}"
+ cdir="$1"; [ "${cdir#/a}" != "$cdir" ] && cdir="${cdir#/}"
cd "$cdir" || :
done
)
@@ -149,8 +139,7 @@ extract_kbc1126ec()
{
e "$kbc1126_ec_dump" f missing && $err "$cbdir: kbc1126 util missing"
(
- x_ cd "$appdir/"
- mv Rompaq/68*.BIN ec.bin || :
+ x_ cd "$appdir/"; mv Rompaq/68*.BIN ec.bin || :
if [ ! -f "ec.bin" ]; then
unar -D ROM.CAB Rom.bin || unar -D Rom.CAB Rom.bin || \
unar -D 68*.CAB Rom.bin || $err "can't extract Rom.bin"
@@ -195,14 +184,10 @@ extract_sch5545ec()
vendor_inject()
{
- set +u +e
-
- [ $# -lt 1 ] && $err "No options specified."
+ set +u +e; [ $# -lt 1 ] && $err "No options specified."
[ "$1" = "listboards" ] && eval "ls -1 config/coreboot || :; exit 0"
- archive="$1"
-
- while getopts n:r:b:m: option; do
+ archive="$1"; while getopts n:r:b:m: option; do
case "$option" in
n) nukemode="$OPTARG" ;;
r) rom="$OPTARG" ;;
@@ -215,11 +200,7 @@ vendor_inject()
check_board || return 0
[ "$nukemode" = "nuke" ] || x_ ./vendor download $board
[ "$vrelease" != "y" ] && patch_rom "$rom"
- [ "$vrelease" = "y" ] && patch_release_roms
-
- [ "$nukemode" = "nuke" ] && return 0
- printf "Friendly reminder (this is *not* an error message):\n"
- printf "Make sure the files were inserted. ALSO:\n%s\n" "$kbnotice"
+ [ "$vrelease" = "y" ] && patch_release_roms; :
}
check_board()
@@ -246,15 +227,13 @@ check_release()
# It will only succeed if the filename is not changed from the build/download
detect_board()
{
- path="$1"
- filename="$(basename "$path")"
+ path="$1"; filename="$(basename "$path")"
case "$filename" in
grub_*|seagrub_*|custom_*)
board="$(echo "$filename" | cut -d '_' -f2-3)" ;;
seabios_withgrub_*)
board="$(echo "$filename" | cut -d '_' -f3-4)" ;;
- *.tar.xz)
- _stripped_prefix="${filename#*_}"
+ *.tar.xz) _stripped_prefix="${filename#*_}"
board="${_stripped_prefix%.tar.xz}" ;;
*) $err "detect_board $filename: could not detect board type"
esac; printf "%s\n" "$board"
@@ -265,10 +244,8 @@ readcfg()
if [ "$board" = "serprog_rp2040" ] || \
[ "$board" = "serprog_stm32" ]; then
return 1
- fi
- boarddir="$cbcfgsdir/$board"
- eval `setcfg "$boarddir/target.cfg"`
- chkvars vcfg tree
+ fi; boarddir="$cbcfgsdir/$board"
+ eval `setcfg "$boarddir/target.cfg"`; chkvars vcfg tree
cbdir="src/coreboot/$tree"
cbfstool="elf/cbfstool/$tree/cbfstool"
@@ -277,13 +254,12 @@ readcfg()
cbfstool="elf/cbfstool/$tree/cbfstool"
ifdtool="elf/ifdtool/$tree/ifdtool"
- x_ ./update trees -d coreboot $tree
+ x_ ./mk -d coreboot $tree
}
patch_release_roms()
{
- remkdir "tmp/romdir"
- tar -xf "$archive" -C "tmp/romdir" || \
+ remkdir "tmp/romdir"; tar -xf "$archive" -C "tmp/romdir" || \
$err "patch_release_roms: !tar -xf \"$archive\" -C \"tmp/romdir\""
for x in "tmp/romdir/bin/"*/*.rom ; do
@@ -311,9 +287,7 @@ patch_release_roms()
patch_rom()
{
- rom="$1"
-
- . "$(check_defconfig "$boarddir")" 2>/dev/null || exit 0
+ rom="$1"; . "$(check_defconfig "$boarddir")" 2>/dev/null || exit 0
[ "$CONFIG_HAVE_MRC" = "y" ] && inject "mrc.bin" "$CONFIG_MRC_FILE" \
"mrc" "0xfffa0000"
@@ -324,8 +298,7 @@ patch_rom()
"$CONFIG_KBC1126_FW1" raw "$CONFIG_KBC1126_FW1_OFFSET" && inject \
ecfw2.bin "$CONFIG_KBC1126_FW2" raw "$CONFIG_KBC1126_FW2_OFFSET"
[ -n "$CONFIG_VGA_BIOS_FILE" ] && [ -n "$CONFIG_VGA_BIOS_ID" ] && \
- inject "pci$CONFIG_VGA_BIOS_ID.rom" \
- "$CONFIG_VGA_BIOS_FILE" "optionrom"
+ inject "pci$CONFIG_VGA_BIOS_ID.rom" "$CONFIG_VGA_BIOS_FILE" optionrom
[ "$CONFIG_INCLUDE_SMSC_SCH5545_EC_FW" = "y" ] && \
[ -n "$CONFIG_SMSC_SCH5545_EC_FW_FILE" ] && \
inject sch5545_ecfw.bin "$CONFIG_SMSC_SCH5545_EC_FW_FILE" raw
@@ -359,7 +332,7 @@ inject()
[ "$_t" != "stage" ] || "$cbfstool" "$rom" add-stage -f \
"$_dest" -n "$cbfsname" -t stage -c lzma || $err "$rom: !add ref"
[ "$_t" = "stage" ] || "$cbfstool" "$rom" add -f "$_dest" \
- -n "$cbfsname" -t $_t $_offset || $err "$rom !add $_t ($_dest)"
+ -n "$cbfsname" -t $_t $_offset || $err "$rom !add $_t ($_dest)"; :
}
modify_gbe()
diff --git a/script/trees b/script/trees
index 814d5362..227b2216 100755
--- a/script/trees
+++ b/script/trees
@@ -12,8 +12,7 @@ set -u -e
eval `setvars "" xarch srcdir premake cmakedir xlang mode makeargs elfdir cmd \
project target target_dir targets xtree _f release bootstrapargs mkhelper \
autoconfargs listfile autogenargs btype tree rev tree_depend build_depend \
- defconfig postmake mkhelpercfg dry dest_dir mdir`
-badhash="n"
+ defconfig postmake mkhelpercfg dry dest_dir mdir`; badhash="n"
main()
{
@@ -38,7 +37,7 @@ main()
done
[ -z "$_f" ] && $err "missing flag (-m/-u/-b/-c/-x/-f/-s/-l/-n)"
[ -z "$project" ] && for p in $(ls -1 config/git); do
- ./update trees $_f "$p" || $err "!./update trees $_f $p"; :
+ ./mk $_f "$p" || $err "!./mk $_f $p"; :
done && return 1
[ -f "config/git/$project/pkg.cfg" ] || $err "'$project' not defined"
@@ -53,9 +52,8 @@ main()
e "$mkhelpercfg" f missing && mkhelpercfg="$TMPDIR/mkhelper.cfg" && \
x_ touch "$mkhelpercfg"
- targets="$@"
- cmd="build_targets $targets" && singletree "$project" && \
- cmd="build_project"
+ targets="$@"; cmd="build_targets $targets"
+ singletree "$project" && cmd="build_project"
remkdir "${tmpgit%/*}"
}
@@ -95,8 +93,7 @@ handle_defconfig()
configure_project "$target_dir" || return 0
x_ mkdir -p "$elfdir/$target"
- chkvars tree
- srcdir="src/$project/$tree"
+ chkvars tree; srcdir="src/$project/$tree"
if [ "$mode" = "distclean" ] || [ "$mode" = "crossgcc-clean" ]; then
[ -d "$srcdir" ] || return 0
@@ -117,17 +114,12 @@ configure_project()
{
eval `setvars "" xarch xlang build_depend autoconfargs xtree postmake \
tree_depend makeargs btype mkhelper bootstrapargs premake release`
- badhash="n"
-
- [ -f "$1/target.cfg" ] || btype="auto"
+ _tcfg="$1/target.cfg"; badhash="n"; [ -f "$_tcfg" ] || btype="auto"
[ -f "$datadir/mkhelper.cfg" ] && eval `setcfg "$datadir/mkhelper.cfg"`
- _tcfg="$1/target.cfg"
while [ -f "$_tcfg" ] || [ "$cmd" != "build_project" ]; do
- eval `setvars "" rev tree`
-
+ eval `setvars "" rev tree`; eval `setcfg "$_tcfg"`
printf "Loading %s config: %s\n" "$project" "$_tcfg"
- eval `setcfg "$_tcfg"`
[ "$_f" = "-d" ] && build_depend="" # dry run
[ "$cmd" = "build_project" ] && break
@@ -136,20 +128,16 @@ configure_project()
[ "${_tcfg%/*/target.cfg}" = "${_tcfg%"/$tree/target.cfg"}" ] \
&& break; _tcfg="${_tcfg%/*/target.cfg}/$tree/target.cfg"
done
-
[ "$XBMK_RELEASE" = "y" ] && [ "$release" = "n" ] && return 1
[ -z "$btype" ] || [ "${mode%config}" = "$mode" ] || return 1
-
[ -z "$mode" ] && build_dependencies
mdir="$PWD/config/submodule/$project"
[ -n "$tree" ] && mdir="$mdir/$tree"
-
[ -f "CHANGELOG" ] || check_project_hashes
- [ "$mode" = "fetch" ] || x_ ./update trees -f "$project" $target
+ [ "$mode" = "fetch" ] || x_ ./mk -f "$project" $target
[ "$mode" = "fetch" ] || return 0
-
[ -f "CHANGELOG" ] && return 1; fetch_${cmd#build_}; return 1
}
@@ -159,7 +147,7 @@ build_dependencies()
bd_p="${bd%%/*}"; bd_t="${bd##*/}"
[ -z "$bd_p" ] && $dry $err "$project/$tree: !bd '$bd'"
[ "${bd##*/}" = "$bd" ] && bd_t=""
- [ -z "$bd_p" ] || $dry ./update trees -b $bd_p $bd_t \
+ [ -z "$bd_p" ] || $dry ./mk -b $bd_p $bd_t \
|| $err "!mk $project/$tree $bd_p/$bd_t"; continue
done; return 0
}
@@ -167,28 +155,23 @@ build_dependencies()
check_project_hashes()
{
mkdir -p "$XBMK_CACHE/hash" || $err "!mkdir '$XBMK_CACHE/hash'"
-
- old_pjhash=""
- [ ! -f "$XBMK_CACHE/hash/$project$tree" ] || \
+ old_pjhash=""; [ ! -f "$XBMK_CACHE/hash/$project$tree" ] || \
read -r old_pjhash < "$XBMK_CACHE/hash/$project$tree"
x_ rm -f "$TMPDIR/project.list" "$TMPDIR/project.hash" \
"$TMPDIR/project.tmp"; x_ touch "$TMPDIR/project.tmp"
x_ touch "$TMPDIR/project.hash"
- for delcheck in "$datadir" "$configdir/$tree" "$mdir"; do
- [ -d "$delcheck" ] || continue
- find "$delcheck" -type f -not -path "*/.git*/*" \
- >> "$TMPDIR/project.tmp" || \
- $err "!find $delcheck > project.tmp"
- done
- sort "$TMPDIR/project.tmp" > "$TMPDIR/project.list" || \
+ for rmchk in "$datadir" "$configdir/$tree" "$mdir"; do
+ [ -d "$rmchk" ] || continue
+ find "$rmchk" -type f -not -path "*/.git*/*" >> \
+ "$TMPDIR/project.tmp" || $err "!find $rmchk > project.tmp"
+ done; sort "$TMPDIR/project.tmp" > "$TMPDIR/project.list" || \
$err "!sort project tmp/list"
- while read -r delcheck; do
- [ -f "$delcheck" ] || continue
- sha512sum "$delcheck" | awk '{print $1}' >> \
- "$TMPDIR/project.hash" || $err "!findhash $delcheck"
+ while read -r rmchk; do
+ [ ! -f "$rmchk" ] || sha512sum "$rmchk" | awk \
+ '{print $1}' >> "$TMPDIR/project.hash" || $err "!h $rmchk"
done < "$TMPDIR/project.list"
pjhash="$(sha512sum "$TMPDIR/project.hash" | awk '{print $1}')" || :
@@ -200,7 +183,7 @@ check_project_hashes()
[ "$badhash" = "n" ] || rm -Rf "src/$project/$tree" \
"elf/$project/$tree" "elf/$project/$target" || \
- $err "!rmproject $project $tree"; :
+ $err "!rm $project $tree"; :
}
check_cross_compiler()
@@ -211,7 +194,7 @@ check_cross_compiler()
[ "$project" != "coreboot" ] && cbdir="src/coreboot/default"
[ -n "$xtree" ] && cbdir="src/coreboot/$xtree"
- x_ ./update trees -f coreboot ${cbdir#src/coreboot/}
+ x_ ./mk -f coreboot ${cbdir#src/coreboot/}
export PATH="$PWD/$cbdir/util/crossgcc/xgcc/bin:$PATH"
export CROSS_COMPILE="${xarch% *}-"
@@ -261,7 +244,6 @@ handle_makefile()
run_make_command()
{
[ -z "$premake" ] || [ -n "$mode" ] || $premake || $err "!$premake"
-
$dry check_cmake "$srcdir" && [ -z "$mode" ] && $dry check_autoconf \
"$srcdir"; $dry check_makefile "$srcdir" || return 1