container-build.sh 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677
  1. #!/usr/bin/env bash
  2. # -----------------------------------------------------------------------------
  3. # This file is part of the xPacks distribution.
  4. # (https://xpack.github.io)
  5. # Copyright (c) 2019 Liviu Ionescu.
  6. #
  7. # Permission to use, copy, modify, and/or distribute this software
  8. # for any purpose is hereby granted, under the terms of the MIT license.
  9. # -----------------------------------------------------------------------------
  10. # -----------------------------------------------------------------------------
  11. # Safety settings (see https://gist.github.com/ilg-ul/383869cbb01f61a51c4d).
  12. if [[ ! -z ${DEBUG} ]]
  13. then
  14. set ${DEBUG} # Activate the expand mode if DEBUG is anything but empty.
  15. else
  16. DEBUG=""
  17. fi
  18. set -o errexit # Exit if command failed.
  19. set -o pipefail # Exit if pipe failed.
  20. set -o nounset # Exit if variable not set.
  21. # Remove the initial space and instead use '\n'.
  22. IFS=$'\n\t'
  23. # -----------------------------------------------------------------------------
  24. # Identify the script location, to reach, for example, the helper scripts.
  25. build_script_path="$0"
  26. if [[ "${build_script_path}" != /* ]]
  27. then
  28. # Make relative path absolute.
  29. build_script_path="$(pwd)/$0"
  30. fi
  31. script_folder_path="$(dirname "${build_script_path}")"
  32. script_folder_name="$(basename "${script_folder_path}")"
  33. # =============================================================================
  34. # Inner script to run inside Docker containers to build the
  35. # xPack GNU Arm Embedded GCC distribution packages.
  36. # For native builds, it runs on the host (macOS build cases,
  37. # and development builds for GNU/Linux).
  38. # Credits: GNU Tools for Arm Embedded Processors, version 7, by Arm.
  39. # -----------------------------------------------------------------------------
  40. defines_script_path="${script_folder_path}/defs-source.sh"
  41. echo "Definitions source script: \"${defines_script_path}\"."
  42. source "${defines_script_path}"
  43. # This file is generated by the host build script.
  44. host_defines_script_path="${script_folder_path}/host-defs-source.sh"
  45. echo "Host definitions source script: \"${host_defines_script_path}\"."
  46. source "${host_defines_script_path}"
  47. common_helper_functions_script_path="${script_folder_path}/helper/common-functions-source.sh"
  48. echo "Common helper functions source script: \"${common_helper_functions_script_path}\"."
  49. source "${common_helper_functions_script_path}"
  50. container_functions_script_path="${script_folder_path}/helper/container-functions-source.sh"
  51. echo "Container helper functions source script: \"${container_functions_script_path}\"."
  52. source "${container_functions_script_path}"
  53. container_libs_functions_script_path="${script_folder_path}/${CONTAINER_LIBS_FUNCTIONS_SCRIPT_NAME}"
  54. echo "Container lib functions source script: \"${container_libs_functions_script_path}\"."
  55. source "${container_libs_functions_script_path}"
  56. container_apps_functions_script_path="${script_folder_path}/${CONTAINER_APPS_FUNCTIONS_SCRIPT_NAME}"
  57. echo "Container app functions source script: \"${container_apps_functions_script_path}\"."
  58. source "${container_apps_functions_script_path}"
  59. # -----------------------------------------------------------------------------
  60. if [ ! -z "#{DEBUG}" ]
  61. then
  62. echo $@
  63. fi
  64. WITH_STRIP="y"
  65. WITHOUT_MULTILIB=""
  66. WITH_PDF="y"
  67. WITH_HTML="n"
  68. WITH_NEWLIB_LTO="n"
  69. WITH_LIBS_LTO="n"
  70. IS_DEVELOP=""
  71. IS_DEBUG=""
  72. LINUX_INSTALL_PATH=""
  73. JOBS="1"
  74. while [ $# -gt 0 ]
  75. do
  76. case "$1" in
  77. --disable-strip)
  78. WITH_STRIP="n"
  79. shift
  80. ;;
  81. --without-pdf)
  82. WITH_PDF="n"
  83. shift
  84. ;;
  85. --with-pdf)
  86. WITH_PDF="y"
  87. shift
  88. ;;
  89. --without-html)
  90. WITH_HTML="n"
  91. shift
  92. ;;
  93. --with-html)
  94. WITH_HTML="y"
  95. shift
  96. ;;
  97. --jobs)
  98. JOBS=$2
  99. shift 2
  100. ;;
  101. --develop)
  102. IS_DEVELOP="y"
  103. shift
  104. ;;
  105. --debug)
  106. IS_DEBUG="y"
  107. WITH_STRIP="n"
  108. shift
  109. ;;
  110. # --- specific
  111. --linux-install-path)
  112. LINUX_INSTALL_PATH="$2"
  113. shift 2
  114. ;;
  115. --disable-multilib)
  116. WITHOUT_MULTILIB="y"
  117. shift
  118. ;;
  119. *)
  120. echo "Unknown action/option $1"
  121. exit 1
  122. ;;
  123. esac
  124. done
  125. if [ "${IS_DEBUG}" == "y" ]
  126. then
  127. WITH_STRIP="n"
  128. fi
  129. # -----------------------------------------------------------------------------
  130. start_timer
  131. detect_container
  132. prepare_xbb_env
  133. prepare_xbb_extras
  134. # -----------------------------------------------------------------------------
  135. function add_linux_install_path()
  136. {
  137. # Verify that the compiler is there.
  138. "${WORK_FOLDER_PATH}/${LINUX_INSTALL_PATH}/bin/${GCC_TARGET}-gcc" --version
  139. export PATH="${WORK_FOLDER_PATH}/${LINUX_INSTALL_PATH}/bin:${PATH}"
  140. echo ${PATH}
  141. export LD_LIBRARY_PATH="${WORK_FOLDER_PATH}/${LINUX_INSTALL_PATH}/bin:${LD_LIBRARY_PATH}"
  142. echo ${LD_LIBRARY_PATH}
  143. }
  144. # -----------------------------------------------------------------------------
  145. APP_PREFIX_NANO="${INSTALL_FOLDER_PATH}/${APP_LC_NAME}-nano"
  146. # The \x2C is a comma in hex; without this trick the regular expression
  147. # that processes this string in the Makefile, silently fails and the
  148. # bfdver.h file remains empty.
  149. BRANDING="${BRANDING}\x2C ${TARGET_BITS}-bit"
  150. CFLAGS_OPTIMIZATIONS_FOR_TARGET="-ffunction-sections -fdata-sections -O2"
  151. # https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads
  152. # https://gcc.gnu.org/viewcvs/gcc/branches/ARM/
  153. # For the main GCC version, check gcc/BASE-VER.
  154. # -----------------------------------------------------------------------------
  155. # Defaults. Must be present.
  156. # Redefine to existing file names to enable patches.
  157. BINUTILS_PATCH=""
  158. GCC_PATCH=""
  159. GDB_PATCH=""
  160. HAS_WINPTHREAD=""
  161. BINUTILS_PROJECT_NAME="binutils-gdb"
  162. BINUTILS_GIT_URL=""
  163. WITH_GDB_PY="y"
  164. WITH_GDB_PY3=""
  165. PYTHON3_VERSION=""
  166. USE_PLATFORM_PYTHON=""
  167. USE_PLATFORM_PYTHON3=""
  168. # Redefine to actual URL if the build should use the Git sources.
  169. # Also be sure GDB_GIT_BRANCH and GDB_GIT_COMMIT are defined
  170. GDB_GIT_URL=""
  171. # Defined for completeness, not yet used by download_gdb().
  172. GDB_ARCHIVE_URL=""
  173. MULTILIB_FLAGS=""
  174. GETTEXT_VERSION=""
  175. USE_SINGLE_FOLDER=""
  176. USE_TAR_GZ=""
  177. # -----------------------------------------------------------------------------
  178. # Redefine to "y" to create the LTO plugin links.
  179. FIX_LTO_PLUGIN=""
  180. if [ "${TARGET_PLATFORM}" == "darwin" ]
  181. then
  182. LTO_PLUGIN_ORIGINAL_NAME="liblto_plugin.0.so"
  183. LTO_PLUGIN_BFD_PATH="lib/bfd-plugins/liblto_plugin.so"
  184. elif [ "${TARGET_PLATFORM}" == "linux" ]
  185. then
  186. LTO_PLUGIN_ORIGINAL_NAME="liblto_plugin.so.0.0.0"
  187. LTO_PLUGIN_BFD_PATH="lib/bfd-plugins/liblto_plugin.so"
  188. elif [ "${TARGET_PLATFORM}" == "win32" ]
  189. then
  190. LTO_PLUGIN_ORIGINAL_NAME="liblto_plugin-0.dll"
  191. LTO_PLUGIN_BFD_PATH="lib/bfd-plugins/liblto_plugin-0.dll"
  192. fi
  193. FIX_LTO_PLUGIN="y"
  194. # -----------------------------------------------------------------------------
  195. README_OUT_FILE_NAME="README-${RELEASE_VERSION}.md"
  196. # In reverse chronological order.
  197. # Keep them in sync with combo archive content.
  198. # https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads
  199. if [[ "${RELEASE_VERSION}" =~ 9\.2\.1-* ]]
  200. then
  201. # https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2019q4/gcc-arm-none-eabi-9-2019-q4-major-src.tar.bz2
  202. GCC_COMBO_VERSION_MAJOR="9"
  203. GCC_COMBO_VERSION_YEAR="2019"
  204. GCC_COMBO_VERSION_QUARTER="q4"
  205. GCC_COMBO_VERSION_KIND="major"
  206. GCC_COMBO_VERSION_SUBFOLDER=""
  207. GCC_COMBO_VERSION="${GCC_COMBO_VERSION_MAJOR}-${GCC_COMBO_VERSION_YEAR}-${GCC_COMBO_VERSION_QUARTER}-${GCC_COMBO_VERSION_KIND}"
  208. GCC_COMBO_FOLDER_NAME="gcc-arm-none-eabi-${GCC_COMBO_VERSION}"
  209. GCC_COMBO_ARCHIVE="${GCC_COMBO_FOLDER_NAME}-src.tar.bz2"
  210. GCC_COMBO_URL="https://developer.arm.com/-/media/Files/downloads/gnu-rm/${GCC_COMBO_VERSION_MAJOR}-${GCC_COMBO_VERSION_YEAR}${GCC_COMBO_VERSION_QUARTER}${GCC_COMBO_VERSION_SUBFOLDER}/${GCC_COMBO_ARCHIVE}"
  211. MULTILIB_FLAGS="--with-multilib-list=rmprofile"
  212. # From /release.txt
  213. BINUTILS_VERSION="2.32"
  214. # From gcc/BASE_VER.
  215. # gcc/LAST_UPDATED: Wed Oct 30 01:03:41 UTC 2019 (revision 277599)
  216. GCC_VERSION="9.2.1"
  217. # git: 572687310059534b2da9428ca19df992509c8a5d from /release.txt.
  218. # VERSION from configure, comment in NEWS.
  219. NEWLIB_VERSION="3.1.0"
  220. # git: e908e11a4f74ab6a06aef8c302a03b2a0dbc4d83 from /release.txt
  221. GDB_VERSION="8.3"
  222. ZLIB_VERSION="1.2.8"
  223. GMP_VERSION="6.1.0"
  224. MPFR_VERSION="3.1.4"
  225. MPC_VERSION="1.0.3"
  226. ISL_VERSION="0.18"
  227. LIBELF_VERSION="0.8.13"
  228. EXPAT_VERSION="2.1.1"
  229. LIBICONV_VERSION="1.15"
  230. XZ_VERSION="5.2.3"
  231. GETTEXT_VERSION="0.19.8.1"
  232. PYTHON_WIN_VERSION="2.7.7"
  233. # GDB 8.3 with Python3 not yet functional on Windows.
  234. # GDB does not know the Python3 API when compiled with mingw.
  235. if [ "${TARGET_PLATFORM}" != "win32" ]
  236. then
  237. WITH_GDB_PY3="y"
  238. PYTHON3_VERSION="3.7.2"
  239. fi
  240. if [ "${TARGET_PLATFORM}" == "darwin" ]
  241. then
  242. USE_PLATFORM_PYTHON="y"
  243. fi
  244. USE_SINGLE_FOLDER="y"
  245. USE_TAR_GZ="y"
  246. BINUTILS_PATCH="binutils-${BINUTILS_VERSION}.patch"
  247. # GDB_PATCH="gdb-${GDB_VERSION}.patch"
  248. elif [[ "${RELEASE_VERSION}" =~ 8\.3\.1-* ]]
  249. then
  250. # https://developer.arm.com/-/media/Files/downloads/gnu-rm/8-2019q3/RC1.1/gcc-arm-none-eabi-8-2019-q3-update-src.tar.bz2
  251. GCC_COMBO_VERSION_MAJOR="8"
  252. GCC_COMBO_VERSION_YEAR="2019"
  253. GCC_COMBO_VERSION_QUARTER="q3"
  254. GCC_COMBO_VERSION_KIND="update"
  255. GCC_COMBO_VERSION_SUBFOLDER="/RC1.1"
  256. GCC_COMBO_VERSION="${GCC_COMBO_VERSION_MAJOR}-${GCC_COMBO_VERSION_YEAR}-${GCC_COMBO_VERSION_QUARTER}-${GCC_COMBO_VERSION_KIND}"
  257. GCC_COMBO_FOLDER_NAME="gcc-arm-none-eabi-${GCC_COMBO_VERSION}"
  258. GCC_COMBO_ARCHIVE="${GCC_COMBO_FOLDER_NAME}-src.tar.bz2"
  259. GCC_COMBO_URL="https://developer.arm.com/-/media/Files/downloads/gnu-rm/${GCC_COMBO_VERSION_MAJOR}-${GCC_COMBO_VERSION_YEAR}${GCC_COMBO_VERSION_QUARTER}${GCC_COMBO_VERSION_SUBFOLDER}/${GCC_COMBO_ARCHIVE}"
  260. MULTILIB_FLAGS="--with-multilib-list=rmprofile"
  261. # From /release.txt
  262. BINUTILS_VERSION="2.32"
  263. # From gcc/BASE_VER. svn 273027 from LAST_UPDATED and /release.txt
  264. GCC_VERSION="8.3.1"
  265. # git: fff17ad73f6ae6b75ef293e17a837f23f6134753 from /release.txt.
  266. # VERSION from configure, comment in NEWS.
  267. NEWLIB_VERSION="3.1.0"
  268. # git: 66263c8cdba32ef18ae0dfabde0867b9b850c441 from /release.txt
  269. GDB_VERSION="8.3"
  270. ZLIB_VERSION="1.2.8"
  271. GMP_VERSION="6.1.0"
  272. MPFR_VERSION="3.1.4"
  273. MPC_VERSION="1.0.3"
  274. # Arm uses 0.15, not 0.18
  275. ISL_VERSION="0.15"
  276. LIBELF_VERSION="0.8.13"
  277. EXPAT_VERSION="2.1.1"
  278. LIBICONV_VERSION="1.14"
  279. XZ_VERSION="5.2.3"
  280. GETTEXT_VERSION="0.19.8.1"
  281. PYTHON_WIN_VERSION="2.7.13"
  282. # GDB 8.3 with Python3 not yet functional on Windows.
  283. # GDB does not know the Python3 API when compiled with mingw.
  284. if [ "${TARGET_PLATFORM}" != "win32" ]
  285. then
  286. WITH_GDB_PY3="y"
  287. PYTHON3_VERSION="3.7.2"
  288. fi
  289. if [ "${RELEASE_VERSION}" != "8.3.1-1.1" \
  290. -a "${RELEASE_VERSION}" != "8.3.1-1.2" ]
  291. then
  292. if [ "${TARGET_PLATFORM}" == "darwin" ]
  293. then
  294. USE_PLATFORM_PYTHON="y"
  295. fi
  296. fi
  297. if [ "${RELEASE_VERSION}" != "8.3.1-1.1" \
  298. -a "${RELEASE_VERSION}" != "8.3.1-1.2" \
  299. -a "${RELEASE_VERSION}" != "8.3.1-1.3" ]
  300. then
  301. # Versions 1.4 and up use the new linearised content, without
  302. # multiple folders.
  303. USE_SINGLE_FOLDER="y"
  304. USE_TAR_GZ="y"
  305. fi
  306. BINUTILS_PATCH="binutils-${BINUTILS_VERSION}.patch"
  307. # GDB_PATCH="gdb-${GDB_VERSION}.patch"
  308. elif [[ "${RELEASE_VERSION}" =~ 7\.3\.1-* ]]
  309. then
  310. # https://developer.arm.com/-/media/Files/downloads/gnu-rm/7-2018q2/gcc-arm-none-eabi-7-2018-q2-update-src.tar.bz2
  311. GCC_COMBO_VERSION_MAJOR="7"
  312. GCC_COMBO_VERSION_YEAR="2018"
  313. GCC_COMBO_VERSION_QUARTER="q2"
  314. GCC_COMBO_VERSION_KIND="update"
  315. GCC_COMBO_VERSION="${GCC_COMBO_VERSION_MAJOR}-${GCC_COMBO_VERSION_YEAR}-${GCC_COMBO_VERSION_QUARTER}-${GCC_COMBO_VERSION_KIND}"
  316. GCC_COMBO_FOLDER_NAME="gcc-arm-none-eabi-${GCC_COMBO_VERSION}"
  317. GCC_COMBO_ARCHIVE="${GCC_COMBO_FOLDER_NAME}-src.tar.bz2"
  318. GCC_COMBO_URL="https://developer.arm.com/-/media/Files/downloads/gnu-rm/${GCC_COMBO_VERSION_MAJOR}-${GCC_COMBO_VERSION_YEAR}${GCC_COMBO_VERSION_QUARTER}/${GCC_COMBO_ARCHIVE}"
  319. MULTILIB_FLAGS="--with-multilib-list=rmprofile"
  320. BINUTILS_VERSION="2.30"
  321. # From gcc/BASE_VER; svn: 261907.
  322. GCC_VERSION="7.3.1"
  323. # git: 3ccfb407af410ba7e54ea0da11ae1e40b554a6f4.
  324. NEWLIB_VERSION="3.0.0"
  325. GDB_VERSION="8.1"
  326. ZLIB_VERSION="1.2.8"
  327. GMP_VERSION="6.1.0"
  328. MPFR_VERSION="3.1.4"
  329. MPC_VERSION="1.0.3"
  330. ISL_VERSION="0.15"
  331. LIBELF_VERSION="0.8.13"
  332. EXPAT_VERSION="2.1.1"
  333. LIBICONV_VERSION="1.14"
  334. XZ_VERSION="5.2.3"
  335. PYTHON_WIN_VERSION="2.7.13"
  336. BINUTILS_PATCH="binutils-${BINUTILS_VERSION}.patch"
  337. GDB_PATCH="gdb-${GDB_VERSION}.patch"
  338. else
  339. echo "Unsupported version ${RELEASE_VERSION}."
  340. exit 1
  341. fi
  342. # -----------------------------------------------------------------------------
  343. if [ ! -f "${BUILD_GIT_PATH}/scripts/${README_OUT_FILE_NAME}" ]
  344. then
  345. echo "Missing ${README_OUT_FILE_NAME}, quit."
  346. exit 1
  347. fi
  348. # -----------------------------------------------------------------------------
  349. # No versioning here, the inner archives use simple names.
  350. BINUTILS_SRC_FOLDER_NAME=${BINUTILS_SRC_FOLDER_NAME:-"binutils"}
  351. GCC_SRC_FOLDER_NAME=${GCC_SRC_FOLDER_NAME:-"gcc"}
  352. NEWLIB_SRC_FOLDER_NAME=${NEWLIB_SRC_FOLDER_NAME:-"newlib"}
  353. GDB_SRC_FOLDER_NAME=${GDB_SRC_FOLDER_NAME:-"gdb"}
  354. # Note: The 5.x build failed with various messages.
  355. if [ "${WITHOUT_MULTILIB}" == "y" ]
  356. then
  357. MULTILIB_FLAGS="--disable-multilib"
  358. fi
  359. # -----------------------------------------------------------------------------
  360. if [ "${TARGET_BITS}" == "32" ]
  361. then
  362. PYTHON_WIN=python-"${PYTHON_WIN_VERSION}"
  363. else
  364. PYTHON_WIN=python-"${PYTHON_WIN_VERSION}".amd64
  365. fi
  366. if [ ! -z "${PYTHON3_VERSION}" ]
  367. then
  368. PYTHON3_VERSION_MAJOR=$(echo ${PYTHON3_VERSION} | sed -e 's|\([0-9]\)\..*|\1|')
  369. PYTHON3_VERSION_MINOR=$(echo ${PYTHON3_VERSION} | sed -e 's|\([0-9]\)\.\([0-9]\)\..*|\2|')
  370. if [ "${TARGET_BITS}" == "32" ]
  371. then
  372. PYTHON3_WIN_EMBED_FOLDER_NAME=python-"${PYTHON3_VERSION}.post1-embed-win32"
  373. else
  374. PYTHON3_WIN_EMBED_FOLDER_NAME=python-"${PYTHON3_VERSION}.post1-embed-amd64"
  375. fi
  376. export PYTHON3_WIN_EMBED_FOLDER_NAME
  377. export PYTHON3_SRC_FOLDER_NAME="Python-${PYTHON3_VERSION}"
  378. export PYTHON3_FOLDER_NAME="Python-${PYTHON3_VERSION}"
  379. fi
  380. # -----------------------------------------------------------------------------
  381. echo
  382. echo "Here we go..."
  383. echo
  384. # Download the combo package from Arm.
  385. download_gcc_combo
  386. if [ "${TARGET_PLATFORM}" == "win32" ]
  387. then
  388. # The Windows GDB needs some headers from the Python distribution.
  389. if [ "${WITH_GDB_PY3}" == "y" ]
  390. then
  391. download_python_win
  392. fi
  393. if [ "${WITH_GDB_PY3}" == "y" ]
  394. then
  395. download_python3_win
  396. fi
  397. fi
  398. # -----------------------------------------------------------------------------
  399. # Build dependent libraries.
  400. # For better control, without it some components pick the lib packed
  401. # inside the archive.
  402. do_zlib
  403. # The classical GCC libraries.
  404. do_gmp
  405. do_mpfr
  406. do_mpc
  407. do_isl
  408. # More libraries.
  409. do_libelf
  410. do_expat
  411. do_libiconv
  412. do_xz
  413. if [ ! -z "${GETTEXT_VERSION}" ]
  414. then
  415. do_gettext
  416. fi
  417. # -----------------------------------------------------------------------------
  418. # The task descriptions are from the Arm build script.
  419. # Task [III-0] /$HOST_NATIVE/binutils/
  420. # Task [IV-1] /$HOST_MINGW/binutils/
  421. do_binutils
  422. # copy_dir to libs included above
  423. if [ "${TARGET_PLATFORM}" != "win32" ]
  424. then
  425. # Task [III-1] /$HOST_NATIVE/gcc-first/
  426. do_gcc_first
  427. # Task [III-2] /$HOST_NATIVE/newlib/
  428. do_newlib ""
  429. # Task [III-3] /$HOST_NATIVE/newlib-nano/
  430. do_newlib "-nano"
  431. # Task [III-4] /$HOST_NATIVE/gcc-final/
  432. do_gcc_final ""
  433. # Task [III-5] /$HOST_NATIVE/gcc-size-libstdcxx/
  434. do_gcc_final "-nano"
  435. else
  436. # Task [IV-2] /$HOST_MINGW/copy_libs/
  437. copy_linux_libs
  438. # Task [IV-3] /$HOST_MINGW/gcc-final/
  439. do_gcc_final ""
  440. fi
  441. # Task [III-6] /$HOST_NATIVE/gdb/
  442. # Task [IV-4] /$HOST_MINGW/gdb/
  443. do_gdb ""
  444. if [ "${WITH_GDB_PY}" == "y" ]
  445. then
  446. do_gdb "-py"
  447. fi
  448. if [ "${WITH_GDB_PY3}" == "y" ]
  449. then
  450. do_gdb "-py3"
  451. fi
  452. # Task [III-7] /$HOST_NATIVE/build-manual
  453. # Nope, the build process is different.
  454. # -----------------------------------------------------------------------------
  455. # Task [III-8] /$HOST_NATIVE/pretidy/
  456. # Task [IV-5] /$HOST_MINGW/pretidy/
  457. tidy_up
  458. # Task [III-9] /$HOST_NATIVE/strip_host_objects/
  459. # Task [IV-6] /$HOST_MINGW/strip_host_objects/
  460. if [ "${WITH_STRIP}" == "y" ]
  461. then
  462. strip_binaries
  463. fi
  464. # Must be done after gcc 2 make install, otherwise some wrong links
  465. # are created in libexec.
  466. # Must also be done after strip binaries, since strip after patchelf
  467. # damages the binaries.
  468. prepare_app_folder_libraries
  469. if [ "${WITH_STRIP}" == "y" -a "${TARGET_PLATFORM}" != "win32" ]
  470. then
  471. # Task [III-10] /$HOST_NATIVE/strip_target_objects/
  472. strip_libs
  473. fi
  474. final_tunings
  475. # Task [IV-7] /$HOST_MINGW/installation/
  476. # Nope, no setup.exe.
  477. # Task [III-11] /$HOST_NATIVE/package_tbz2/
  478. # Task [IV-8] /Package toolchain in zip format/
  479. # See create_archive below.
  480. # -----------------------------------------------------------------------------
  481. check_binaries
  482. copy_distro_files
  483. create_archive
  484. # Change ownership to non-root Linux user.
  485. fix_ownership
  486. # -----------------------------------------------------------------------------
  487. # Final checks.
  488. # To keep everything as pristine as possible, run tests
  489. # only after the archive is packed.
  490. run_binutils
  491. run_gcc
  492. run_gdb
  493. if [ "${TARGET_PLATFORM}" != "win32" ]
  494. then
  495. if [ "${WITH_GDB_PY}" == "y" ]
  496. then
  497. run_gdb "-py"
  498. fi
  499. if [ "${WITH_GDB_PY3}" == "y" ]
  500. then
  501. run_gdb "-py3"
  502. fi
  503. fi
  504. # -----------------------------------------------------------------------------
  505. stop_timer
  506. exit 0
  507. # -----------------------------------------------------------------------------