ext-toolchain.sh 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651
  1. #!/usr/bin/env bash
  2. #
  3. # Script for various external toolchain tasks, refer to
  4. # the --help output for more information.
  5. #
  6. # Copyright (C) 2012 Jo-Philipp Wich <[email protected]>
  7. #
  8. # This program is free software; you can redistribute it and/or modify
  9. # it under the terms of the GNU General Public License as published by
  10. # the Free Software Foundation; either version 2 of the License, or
  11. # (at your option) any later version.
  12. #
  13. # This program is distributed in the hope that it will be useful,
  14. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. # GNU General Public License for more details.
  17. #
  18. # You should have received a copy of the GNU General Public License
  19. # along with this program; if not, write to the Free Software
  20. # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  21. CC=""
  22. CXX=""
  23. CPP=""
  24. CFLAGS=""
  25. TOOLCHAIN="."
  26. LIBC_TYPE=""
  27. GCC_VERSION=""
  28. # Library specs
  29. LIB_SPECS="
  30. c: ld-* lib{anl,c,cidn,crypt,dl,m,nsl,nss_dns,nss_files,resolv,util}
  31. rt: librt-* librt
  32. pthread: libpthread-* libpthread
  33. stdcpp: libstdc++
  34. thread_db: libthread-db
  35. gcc: libgcc_s
  36. ssp: libssp
  37. gfortran: libgfortran
  38. gomp: libgomp
  39. atomic: libatomic
  40. quadmath: libquadmath
  41. asan: libasan
  42. tasan: libtsan
  43. lasan: liblsan
  44. ubasan: libubsan
  45. "
  46. # Binary specs
  47. BIN_SPECS="
  48. ldd: ldd
  49. ldconfig: ldconfig
  50. gdb: gdb
  51. gdbserver: gdbserver
  52. "
  53. OVERWRITE_CONFIG=""
  54. test_c() {
  55. cat <<-EOT | "${CC:-false}" $CFLAGS -o /dev/null -x c - 2>/dev/null
  56. #include <stdio.h>
  57. int main(int argc, char **argv)
  58. {
  59. printf("Hello, world!\n");
  60. return 0;
  61. }
  62. EOT
  63. }
  64. test_cxx() {
  65. cat <<-EOT | "${CXX:-false}" $CFLAGS -o /dev/null -x c++ - 2>/dev/null
  66. #include <iostream>
  67. using namespace std;
  68. int main()
  69. {
  70. cout << "Hello, world!" << endl;
  71. return 0;
  72. }
  73. EOT
  74. }
  75. test_softfloat() {
  76. cat <<-EOT | "$CC" $CFLAGS -msoft-float -o /dev/null -x c - 2>/dev/null
  77. int main(int argc, char **argv)
  78. {
  79. double a = 0.1;
  80. double b = 0.2;
  81. double c = (a + b) / (a * b);
  82. return 1;
  83. }
  84. EOT
  85. }
  86. test_uclibc() {
  87. local sysroot="$("$CC" $CFLAGS -print-sysroot 2>/dev/null)"
  88. if [ -d "${sysroot:-$TOOLCHAIN}" ]; then
  89. local lib
  90. for lib in "${sysroot:-$TOOLCHAIN}"/{lib,usr/lib,usr/local/lib}/ld*-uClibc*.so*; do
  91. if [ -f "$lib" ] && [ ! -h "$lib" ]; then
  92. return 0
  93. fi
  94. done
  95. fi
  96. return 1
  97. }
  98. test_feature() {
  99. local feature="$1"; shift
  100. # find compilers, libc type
  101. probe_cc
  102. probe_cxx
  103. probe_libc
  104. # common toolchain feature tests
  105. case "$feature" in
  106. c) test_c; return $? ;;
  107. c++) test_cxx; return $? ;;
  108. soft*) test_softfloat; return $? ;;
  109. esac
  110. # assume eglibc/glibc supports all libc features
  111. if [ "$LIBC_TYPE" != "uclibc" ]; then
  112. return 0
  113. fi
  114. # uclibc feature tests
  115. local inc
  116. local sysroot="$("$CC" "$@" -muclibc -print-sysroot 2>/dev/null)"
  117. for inc in "include" "usr/include" "usr/local/include"; do
  118. local conf="${sysroot:-$TOOLCHAIN}/$inc/bits/uClibc_config.h"
  119. if [ -f "$conf" ]; then
  120. case "$feature" in
  121. lfs) grep -q '__UCLIBC_HAS_LFS__ 1' "$conf"; return $?;;
  122. ipv6) grep -q '__UCLIBC_HAS_IPV6__ 1' "$conf"; return $?;;
  123. rpc) grep -q '__UCLIBC_HAS_RPC__ 1' "$conf"; return $?;;
  124. locale) grep -q '__UCLIBC_HAS_LOCALE__ 1' "$conf"; return $?;;
  125. wchar) grep -q '__UCLIBC_HAS_WCHAR__ 1' "$conf"; return $?;;
  126. threads) grep -q '__UCLIBC_HAS_THREADS__ 1' "$conf"; return $?;;
  127. esac
  128. fi
  129. done
  130. return 1
  131. }
  132. find_libs() {
  133. local spec="$(echo "$LIB_SPECS" | sed -ne "s#^[[:space:]]*$1:##ip")"
  134. # glibc doesn't have libcrypt since 2.39
  135. if [ "$LIBC_TYPE" = "glibc" ]; then
  136. spec=$(printf '%s' "${spec}" | sed 's/,crypt,//')
  137. fi
  138. if [ -n "$spec" ] && probe_cpp; then
  139. local libdir libdirs
  140. for libdir in $(
  141. "$CPP" $CFLAGS -v -x c /dev/null 2>&1 | \
  142. sed -ne 's#:# #g; s#^LIBRARY_PATH=##p'
  143. ); do
  144. if [ -d "$libdir" ]; then
  145. libdirs="$libdirs $(cd "$libdir"; pwd)/"
  146. fi
  147. done
  148. local pattern
  149. for pattern in $(eval echo $spec); do
  150. find $libdirs -name "$pattern.so*" | sort -u
  151. done
  152. return 0
  153. fi
  154. return 1
  155. }
  156. find_bins() {
  157. local spec="$(echo "$BIN_SPECS" | sed -ne "s#^[[:space:]]*$1:##ip")"
  158. if [ -n "$spec" ] && probe_cpp; then
  159. local sysroot="$("$CPP" -print-sysroot)"
  160. local bindir bindirs
  161. for bindir in $(
  162. echo "${sysroot:-$TOOLCHAIN}/bin";
  163. echo "${sysroot:-$TOOLCHAIN}/usr/bin";
  164. echo "${sysroot:-$TOOLCHAIN}/usr/local/bin";
  165. "$CPP" $CFLAGS -v -x c /dev/null 2>&1 | \
  166. sed -ne 's#:# #g; s#^COMPILER_PATH=##p'
  167. ); do
  168. if [ -d "$bindir" ]; then
  169. bindirs="$bindirs $(cd "$bindir"; pwd)/"
  170. fi
  171. done
  172. local pattern
  173. for pattern in $(eval echo $spec); do
  174. find $bindirs -name "$pattern" | sort -u
  175. done
  176. return 0
  177. fi
  178. return 1
  179. }
  180. find_gcc_version() {
  181. if [ -f $TOOLCHAIN/info.mk ]; then
  182. GCC_VERSION=$(grep GCC_VERSION $TOOLCHAIN/info.mk | sed 's/GCC_VERSION=//')
  183. return 0
  184. fi
  185. echo "Warning! Can't find info.mk, trying to detect with alternative way."
  186. # Very fragile detection
  187. GCC_VERSION=$(find $TOOLCHAIN/bin | grep -oE "gcc-[0-9]+\.[0-9]+\.[0-9]+$" | \
  188. head -1 | sed 's/gcc-//')
  189. }
  190. wrap_bin_cc() {
  191. local out="$1"
  192. local bin="$2"
  193. echo '#!/bin/sh' > "$out"
  194. echo 'for arg in "$@"; do' >> "$out"
  195. echo ' case "$arg" in -l*|-L*|-shared|-static)' >> "$out"
  196. echo -n ' exec "'"$bin"'" '"$CFLAGS"' ${STAGING_DIR:+' >> "$out"
  197. echo -n '-idirafter "$STAGING_DIR/usr/include" ' >> "$out"
  198. echo -n '-L "$STAGING_DIR/usr/lib" ' >> "$out"
  199. echo '-Wl,-rpath-link,"$STAGING_DIR/usr/lib"} "$@" ;;' >> "$out"
  200. echo ' esac' >> "$out"
  201. echo 'done' >> "$out"
  202. echo -n 'exec "'"$bin"'" '"$CFLAGS"' ${STAGING_DIR:+' >> "$out"
  203. echo '-idirafter "$STAGING_DIR/usr/include"} "$@"' >> "$out"
  204. chmod +x "$out"
  205. }
  206. wrap_bin_ld() {
  207. local out="$1"
  208. local bin="$2"
  209. echo '#!/bin/sh' > "$out"
  210. echo -n 'exec "'"$bin"'" ${STAGING_DIR:+' >> "$out"
  211. echo -n '-L "$STAGING_DIR/usr/lib" ' >> "$out"
  212. echo '-rpath-link "$STAGING_DIR/usr/lib"} "$@"' >> "$out"
  213. chmod +x "$out"
  214. }
  215. wrap_bin_other() {
  216. local out="$1"
  217. local bin="$2"
  218. echo '#!/bin/sh' > "$out"
  219. echo 'exec "'"$bin"'" "$@"' >> "$out"
  220. chmod +x "$out"
  221. }
  222. wrap_bins() {
  223. if probe_cc; then
  224. mkdir -p "$1" || return 1
  225. local cmd
  226. for cmd in "${CC%-*}-"*; do
  227. if [ -x "$cmd" ]; then
  228. local out="$1/${cmd##*/}"
  229. local bin="$cmd"
  230. if [ -x "$out" ] && ! grep -q STAGING_DIR "$out"; then
  231. mv "$out" "$out.bin"
  232. bin='$(dirname "$0")/'"${out##*/}"'.bin'
  233. fi
  234. case "${cmd##*/}" in
  235. *-*cc|*-*cc-*|*-*++|*-*++-*|*-cpp)
  236. wrap_bin_cc "$out" "$bin"
  237. ;;
  238. *-ld)
  239. wrap_bin_ld "$out" "$bin"
  240. ;;
  241. *)
  242. wrap_bin_other "$out" "$bin"
  243. ;;
  244. esac
  245. fi
  246. done
  247. return 0
  248. fi
  249. return 1
  250. }
  251. print_config() {
  252. local mktarget="$1"
  253. local mksubtarget
  254. local target="$("$CC" $CFLAGS -dumpmachine)"
  255. local version="$("$CC" $CFLAGS -dumpversion)"
  256. local cpuarch="${target%%-*}"
  257. # get CC; strip version; strip gcc and add - suffix
  258. local prefix="${CC##*/}"; prefix="${prefix%-$version}"; prefix="${prefix%-*}-"
  259. local config="${0%/scripts/*}/.config"
  260. # if no target specified, print choice list and exit
  261. if [ -z "$mktarget" ]; then
  262. # prepare metadata
  263. if [ ! -f "${0%/scripts/*}/tmp/.targetinfo" ]; then
  264. "${0%/*}/scripts/config/mconf" prepare-tmpinfo
  265. fi
  266. local mktargets=$(
  267. sed -ne "
  268. /^Target: / { h };
  269. /^Target-Arch: $cpuarch\$/ { x; s#^Target: ##p }
  270. " "${0%/scripts/*}/tmp/.targetinfo" | sort -u
  271. )
  272. for mktarget in $mktargets; do
  273. case "$mktarget" in */*)
  274. mktargets=$(echo "$mktargets" | sed -e "/^${mktarget%/*}\$/d")
  275. esac
  276. done
  277. if [ -n "$mktargets" ]; then
  278. echo "Available targets:" >&2
  279. echo $mktargets >&2
  280. else
  281. echo -e "Could not find a suitable OpenWrt target for " >&2
  282. echo -e "CPU architecture '$cpuarch' - you need to " >&2
  283. echo -e "define one first!" >&2
  284. fi
  285. return 1
  286. fi
  287. # bail out if there is a .config already
  288. if [ -f "$config" ]; then
  289. if [ "$OVERWRITE_CONFIG" == "" ]; then
  290. echo "There already is a .config file, refusing to overwrite!" >&2
  291. return 1
  292. else
  293. echo "There already is a .config file, trying to overwrite!"
  294. fi
  295. fi
  296. case "$mktarget" in */*)
  297. mksubtarget="${mktarget#*/}"
  298. mktarget="${mktarget%/*}"
  299. ;; esac
  300. if [ ! -f "$config" ]; then
  301. touch "$config"
  302. fi
  303. echo "CONFIG_TARGET_${mktarget}=y" >> "$config"
  304. if [ -n "$mksubtarget" ]; then
  305. echo "CONFIG_TARGET_${mktarget}_${mksubtarget}=y" >> "$config"
  306. fi
  307. if test_feature "softfloat"; then
  308. echo "CONFIG_SOFT_FLOAT=y" >> "$config"
  309. else
  310. echo "# CONFIG_SOFT_FLOAT is not set" >> "$config"
  311. fi
  312. if test_feature "ipv6"; then
  313. echo "CONFIG_IPV6=y" >> "$config"
  314. else
  315. echo "# CONFIG_IPV6 is not set" >> "$config"
  316. fi
  317. if test_feature "locale"; then
  318. echo "CONFIG_BUILD_NLS=y" >> "$config"
  319. else
  320. echo "# CONFIG_BUILD_NLS is not set" >> "$config"
  321. fi
  322. echo "CONFIG_DEVEL=y" >> "$config"
  323. echo "CONFIG_EXTERNAL_TOOLCHAIN=y" >> "$config"
  324. echo "CONFIG_TOOLCHAIN_ROOT=\"$TOOLCHAIN\"" >> "$config"
  325. echo "CONFIG_TOOLCHAIN_PREFIX=\"$prefix\"" >> "$config"
  326. echo "CONFIG_TARGET_NAME=\"$target\"" >> "$config"
  327. if [ -f "$config" ]; then
  328. sed -i '/CONFIG_EXTERNAL_TOOLCHAIN_LIBC_USE_MUSL/d' "$config"
  329. sed -i '/CONFIG_EXTERNAL_TOOLCHAIN_LIBC_USE_GLIBC/d' "$config"
  330. fi
  331. if [ "$LIBC_TYPE" == glibc ]; then
  332. echo "CONFIG_EXTERNAL_TOOLCHAIN_LIBC_USE_GLIBC=y" >> "$config"
  333. elif [ "$LIBC_TYPE" == musl ]; then
  334. echo "CONFIG_EXTERNAL_TOOLCHAIN_LIBC_USE_MUSL=y" >> "$config"
  335. else
  336. echo "Can't detect LIBC type. Aborting!" >&2
  337. return 1
  338. fi
  339. if [ -n "$GCC_VERSION" ]; then
  340. echo "CONFIG_EXTERNAL_GCC_VERSION=\"$GCC_VERSION\"" >> "$config"
  341. else
  342. echo "Can't detect GCC version. Aborting!" >&2
  343. return 1
  344. fi
  345. local lib
  346. for lib in C RT PTHREAD GCC STDCPP SSP GFORTRAN GOMP ATOMIC QUADMATH ASAN TSAN LSAN UBSAN; do
  347. local file
  348. local spec=""
  349. local llib="$(echo "$lib" | sed -e 's#.*#\L&#')"
  350. for file in $(find_libs "$lib"); do
  351. spec="${spec:+$spec }$(echo "$file" | sed -e "s#^$TOOLCHAIN#.#")"
  352. done
  353. if [ -n "$spec" ]; then
  354. echo "CONFIG_PACKAGE_lib${llib}=y" >> "$config"
  355. echo "CONFIG_LIB${lib}_FILE_SPEC=\"$spec\"" >> "$config"
  356. else
  357. echo "# CONFIG_PACKAGE_lib${llib} is not set" >> "$config"
  358. fi
  359. done
  360. local bin
  361. for bin in LDD LDCONFIG; do
  362. local file
  363. local spec=""
  364. local lbin="$(echo "$bin" | sed -e 's#.*#\L&#')"
  365. for file in $(find_bins "$bin"); do
  366. spec="${spec:+$spec }$(echo "$file" | sed -e "s#^$TOOLCHAIN#.#")"
  367. done
  368. if [ -n "$spec" ]; then
  369. echo "CONFIG_PACKAGE_${lbin}=y" >> "$config"
  370. echo "CONFIG_${bin}_FILE_SPEC=\"$spec\"" >> "$config"
  371. else
  372. echo "# CONFIG_PACKAGE_${lbin} is not set" >> "$config"
  373. fi
  374. done
  375. # inflate
  376. make -C "${0%/scripts/*}" defconfig
  377. return 0
  378. }
  379. probe_cc() {
  380. if [ -z "$CC" ]; then
  381. local bin
  382. for bin in "bin" "usr/bin" "usr/local/bin"; do
  383. local cmd
  384. for cmd in "$TOOLCHAIN/$bin/"*-*cc*; do
  385. if [ -x "$cmd" ] && [ ! -h "$cmd" ]; then
  386. CC="$(cd "${cmd%/*}"; pwd)/${cmd##*/}"
  387. return 0
  388. fi
  389. done
  390. done
  391. return 1
  392. fi
  393. return 0
  394. }
  395. probe_cxx() {
  396. if [ -z "$CXX" ]; then
  397. local bin
  398. for bin in "bin" "usr/bin" "usr/local/bin"; do
  399. local cmd
  400. for cmd in "$TOOLCHAIN/$bin/"*-*++*; do
  401. if [ -x "$cmd" ] && [ ! -h "$cmd" ]; then
  402. CXX="$(cd "${cmd%/*}"; pwd)/${cmd##*/}"
  403. return 0
  404. fi
  405. done
  406. done
  407. return 1
  408. fi
  409. return 0
  410. }
  411. probe_cpp() {
  412. if [ -z "$CPP" ]; then
  413. local bin
  414. for bin in "bin" "usr/bin" "usr/local/bin"; do
  415. local cmd
  416. for cmd in "$TOOLCHAIN/$bin/"*-cpp*; do
  417. if [ -x "$cmd" ] && [ ! -h "$cmd" ]; then
  418. CPP="$(cd "${cmd%/*}"; pwd)/${cmd##*/}"
  419. return 0
  420. fi
  421. done
  422. done
  423. return 1
  424. fi
  425. return 0
  426. }
  427. probe_libc() {
  428. if [ -f $TOOLCHAIN/info.mk ]; then
  429. LIBC_TYPE=$(grep LIBC_TYPE $TOOLCHAIN/info.mk | sed 's/LIBC_TYPE=//')
  430. return 0
  431. fi
  432. echo "Warning! Can't find info.mk, trying to detect with alternative way."
  433. if [ -z "$LIBC_TYPE" ]; then
  434. if test_uclibc; then
  435. LIBC_TYPE="uclibc"
  436. else
  437. LIBC_TYPE="glibc"
  438. fi
  439. fi
  440. return 0
  441. }
  442. while [ -n "$1" ]; do
  443. arg="$1"; shift
  444. case "$arg" in
  445. --toolchain)
  446. [ -d "$1" ] || {
  447. echo "Toolchain directory '$1' does not exist." >&2
  448. exit 1
  449. }
  450. TOOLCHAIN="$(cd "$1"; pwd)"; shift
  451. ;;
  452. --cflags)
  453. CFLAGS="${CFLAGS:+$CFLAGS }$1"; shift
  454. ;;
  455. --print-libc)
  456. if probe_cc; then
  457. probe_libc
  458. echo "$LIBC_TYPE"
  459. exit 0
  460. fi
  461. echo "No C compiler found in '$TOOLCHAIN'." >&2
  462. exit 1
  463. ;;
  464. --print-target)
  465. if probe_cc; then
  466. exec "$CC" $CFLAGS -dumpmachine
  467. fi
  468. echo "No C compiler found in '$TOOLCHAIN'." >&2
  469. exit 1
  470. ;;
  471. --print-bin)
  472. if [ -z "$1" ]; then
  473. echo "Available programs:" >&2
  474. echo $(echo "$BIN_SPECS" | sed -ne 's#:.*$##p') >&2
  475. exit 1
  476. fi
  477. find_bins "$1" || exec "$0" --toolchain "$TOOLCHAIN" --print-bin
  478. exit 0
  479. ;;
  480. --print-libs)
  481. if [ -z "$1" ]; then
  482. echo "Available libraries:" >&2
  483. echo $(echo "$LIB_SPECS" | sed -ne 's#:.*$##p') >&2
  484. exit 1
  485. fi
  486. find_libs "$1" || exec "$0" --toolchain "$TOOLCHAIN" --print-libs
  487. exit 0
  488. ;;
  489. --test)
  490. test_feature "$1"
  491. exit $?
  492. ;;
  493. --wrap)
  494. [ -n "$1" ] || exec "$0" --help
  495. wrap_bins "$1"
  496. exit $?
  497. ;;
  498. --overwrite-config)
  499. OVERWRITE_CONFIG=y
  500. ;;
  501. --config)
  502. if probe_cc; then
  503. probe_libc
  504. find_gcc_version
  505. print_config "$1"
  506. exit $?
  507. fi
  508. echo "No C compiler found in '$TOOLCHAIN'." >&2
  509. exit 1
  510. ;;
  511. -h|--help)
  512. me="$(basename "$0")"
  513. echo -e "\nUsage:\n" >&2
  514. echo -e " $me --toolchain {directory} --print-libc" >&2
  515. echo -e " Print the libc implementation and exit.\n" >&2
  516. echo -e " $me --toolchain {directory} --print-target" >&2
  517. echo -e " Print the GNU target name and exit.\n" >&2
  518. echo -e " $me --toolchain {directory} --print-bin {program}" >&2
  519. echo -e " Print executables belonging to given program," >&2
  520. echo -e " omit program argument to get a list of names.\n" >&2
  521. echo -e " $me --toolchain {directory} --print-libs {library}" >&2
  522. echo -e " Print shared objects belonging to given library," >&2
  523. echo -e " omit library argument to get a list of names.\n" >&2
  524. echo -e " $me --toolchain {directory} --test {feature}" >&2
  525. echo -e " Test given feature, exit code indicates success." >&2
  526. echo -e " Possible features are 'c', 'c++', 'softfloat'," >&2
  527. echo -e " 'lfs', 'rpc', 'ipv6', 'wchar', 'locale' and " >&2
  528. echo -e " 'threads'.\n" >&2
  529. echo -e " $me --toolchain {directory} --wrap {directory}" >&2
  530. echo -e " Create wrapper scripts for C and C++ compiler, " >&2
  531. echo -e " linker, assembler and other key executables in " >&2
  532. echo -e " the directory given with --wrap.\n" >&2
  533. echo -e " $me --toolchain {directory} --config {target}" >&2
  534. echo -e " Analyze the given toolchain and print a suitable" >&2
  535. echo -e " .config for the given target. Omit target " >&2
  536. echo -e " argument to get a list of names.\n" >&2
  537. echo -e " $me --help" >&2
  538. echo -e " Display this help text and exit.\n\n" >&2
  539. echo -e " Most commands also take a --cflags parameter which " >&2
  540. echo -e " is used to specify C flags to be passed to the " >&2
  541. echo -e " cross compiler when performing tests." >&2
  542. echo -e " This parameter may be repeated multiple times." >&2
  543. echo -e " Use --overwrite-config before --config to overwrite" >&2
  544. echo -e " an already present config with the required changes.">&2
  545. exit 1
  546. ;;
  547. *)
  548. echo "Unknown argument '$arg'" >&2
  549. exec $0 --help
  550. ;;
  551. esac
  552. done
  553. exec $0 --help