Changeset 232ec3a1 in mainline
- Timestamp:
- 2018-05-01T13:58:48Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0cb53ea5
- Parents:
- 66855b2
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-05-01 13:58:48)
- git-committer:
- GitHub <noreply@…> (2018-05-01 13:58:48)
- Location:
- tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/autotool.py
r66855b2 r232ec3a1 185 185 if (config['CROSS_TARGET'] == "arm32"): 186 186 gnu_target = "arm-linux-gnueabi" 187 helenos_target = "arm-helenos -gnueabi"187 helenos_target = "arm-helenos" 188 188 189 189 if (config['CROSS_TARGET'] == "ia32"): 190 190 gnu_target = "i686-pc-linux-gnu" 191 helenos_target = "i686- pc-helenos"191 helenos_target = "i686-helenos" 192 192 193 193 if (config['CROSS_TARGET'] == "mips32"): … … 204 204 platform = config['PLATFORM'] 205 205 gnu_target = "arm-linux-gnueabi" 206 helenos_target = "arm-helenos -gnueabi"206 helenos_target = "arm-helenos" 207 207 208 208 if (config['PLATFORM'] == "ia32"): 209 209 platform = config['PLATFORM'] 210 210 gnu_target = "i686-pc-linux-gnu" 211 helenos_target = "i686- pc-helenos"211 helenos_target = "i686-helenos" 212 212 213 213 if (config['PLATFORM'] == "ia64"): 214 214 platform = config['PLATFORM'] 215 215 gnu_target = "ia64-pc-linux-gnu" 216 helenos_target = "ia64- pc-helenos"216 helenos_target = "ia64-helenos" 217 217 218 218 if (config['PLATFORM'] == "mips32"): -
tools/toolchain.sh
r66855b2 r232ec3a1 29 29 # 30 30 31 BINUTILS_GDB_GIT="https://github.com/HelenOS/binutils-gdb.git" 32 33 BINUTILS_BRANCH="binutils-2_30-helenos" 31 34 BINUTILS_VERSION="2.30" 32 BINUTILS_RELEASE="" 35 36 GDB_BRANCH="gdb-8_1-helenos" 37 GDB_VERSION="8.1" 38 39 GCC_GIT="https://github.com/HelenOS/gcc.git" 40 GCC_BRANCH="7_3_0-helenos" 33 41 GCC_VERSION="7.3.0" 34 GDB_VERSION="8.1"35 42 36 43 BASEDIR="`pwd`" 37 44 SRCDIR="$(readlink -f $(dirname "$0"))" 38 BINUTILS="binutils-${BINUTILS_VERSION}${BINUTILS_RELEASE}.tar.bz2"39 GCC="gcc-${GCC_VERSION}.tar.xz"40 GDB="gdb-${GDB_VERSION}.tar.gz"41 45 42 46 REAL_INSTALL=true … … 49 53 50 54 exit 1 51 fi52 }53 54 check_md5() {55 FILE="$1"56 SUM="$2"57 58 COMPUTED="`md5sum "${FILE}" | cut -d' ' -f1`"59 if [ "${SUM}" != "${COMPUTED}" ] ; then60 echo61 echo "Checksum of ${FILE} does not match."62 63 exit 264 55 fi 65 56 } … … 99 90 echo 100 91 echo "The --helenos-target will build HelenOS-specific toolchain" 101 echo "(i.e. it will use *-helenos-* triplet instead of *-linux-*)." 102 echo "This toolchain is installed into /usr/local/cross-helenos by" 103 echo "default. The settings can be changed by setting environment" 104 echo "variable CROSS_HELENOS_PREFIX." 92 echo "(i.e. it will use *-helenos triplet instead of *-linux-*)." 105 93 echo "Using the HelenOS-specific toolchain is still an experimental" 106 94 echo "feature that is not fully supported." … … 148 136 } 149 137 150 download_fetch() {151 SOURCE="$1"152 FILE="$2"153 CHECKSUM="$3"154 155 if [ ! -f "${FILE}" ] ; then156 change_title "Downloading ${FILE}"157 wget -c "${SOURCE}${FILE}" -O "${FILE}".part158 check_error $? "Error downloading ${FILE}."159 160 mv "${FILE}".part "${FILE}"161 fi162 163 check_md5 "${FILE}" "${CHECKSUM}"164 }165 166 source_check() {167 FILE="$1"168 169 if [ ! -f "${FILE}" ] ; then170 echo171 echo "File ${FILE} not found."172 173 exit 4174 fi175 }176 177 138 cleanup_dir() { 178 139 DIR="$1" … … 226 187 } 227 188 228 unpack_tarball() {229 FILE="$1"230 DESC="$2"231 232 change_title "Unpacking ${DESC}"233 echo " >>> Unpacking ${DESC}"234 235 case "${FILE}" in236 *.gz)237 tar -xzf "${FILE}"238 ;;239 *.xz)240 tar -xJf "${FILE}"241 ;;242 *.bz2)243 tar -xjf "${FILE}"244 ;;245 *)246 check_error 1 "Don't know how to unpack ${DESC}."247 ;;248 esac249 check_error $? "Error unpacking ${DESC}."250 }251 252 189 prepare() { 253 190 show_dependencies … … 258 195 check_error $? "Change directory failed." 259 196 260 BINUTILS_SOURCE="ftp://ftp.gnu.org/gnu/binutils/" 261 GCC_SOURCE="ftp://ftp.gnu.org/gnu/gcc/gcc-${GCC_VERSION}/" 262 GDB_SOURCE="ftp://ftp.gnu.org/gnu/gdb/" 263 264 echo ">>> Downloading tarballs" 265 266 download_fetch "${BINUTILS_SOURCE}" "${BINUTILS}" "cc47a2f256b4a593206b4d7e62a60b32" 267 download_fetch "${GCC_SOURCE}" "${GCC}" "be2da21680f27624f3a87055c4ba5af2" 268 download_fetch "${GDB_SOURCE}" "${GDB}" "0c85ecbb43569ec43b1c9230622e84ab" 269 270 echo ">>> Unpacking tarballs" 271 cd "${WORKDIR}" 272 check_error $? "Change directory failed." 273 274 unpack_tarball "${BASEDIR}/downloads/${BINUTILS}" "binutils" 275 unpack_tarball "${BASEDIR}/downloads/${GCC}" "GCC" 276 unpack_tarball "${BASEDIR}/downloads/${GDB}" "GDB" 197 echo ">>> Downloading sources" 198 git clone --depth 1 -b "$BINUTILS_BRANCH" "$BINUTILS_GDB_GIT" "binutils-$BINUTILS_VERSION" 199 git clone --depth 1 -b "$GDB_BRANCH" "$BINUTILS_GDB_GIT" "gdb-$GDB_VERSION" 200 git clone --depth 1 -b "$GCC_BRANCH" "$GCC_GIT" "gcc-$GCC_VERSION" 201 202 # If the directory already existed, pull upstream changes. 203 git -C "binutils-$BINUTILS_VERSION" pull 204 git -C "gdb-$GDB_VERSION" pull 205 git -C "gcc-$GCC_VERSION" pull 277 206 278 207 echo ">>> Downloading GCC prerequisites" … … 284 213 set_target_from_platform() { 285 214 case "$1" in 215 "arm32") 216 GNU_ARCH="arm" 217 ;; 218 "ia32") 219 GNU_ARCH="i686" 220 ;; 221 "mips32") 222 GNU_ARCH="mipsel" 223 ;; 224 "mips32eb") 225 GNU_ARCH="mips" 226 ;; 227 "mips64") 228 GNU_ARCH="mips64el" 229 ;; 230 "ppc32") 231 GNU_ARCH="ppc" 232 ;; 233 *) 234 GNU_ARCH="$1" 235 ;; 236 esac 237 238 HELENOS_TARGET="${GNU_ARCH}-helenos" 239 240 case "$1" in 286 241 "amd64") 287 LINUX_TARGET="amd64-unknown-elf" 288 HELENOS_TARGET="amd64-helenos" 242 LINUX_TARGET="${GNU_ARCH}-unknown-elf" 289 243 ;; 290 244 "arm32") 291 LINUX_TARGET="arm-linux-gnueabi" 292 HELENOS_TARGET="arm-helenos-gnueabi" 293 ;; 294 "ia32") 295 LINUX_TARGET="i686-pc-linux-gnu" 296 HELENOS_TARGET="i686-pc-helenos" 297 ;; 298 "ia64") 299 LINUX_TARGET="ia64-pc-linux-gnu" 300 HELENOS_TARGET="ia64-pc-helenos" 301 ;; 302 "mips32") 303 LINUX_TARGET="mipsel-linux-gnu" 304 HELENOS_TARGET="mipsel-helenos" 305 ;; 306 "mips32eb") 307 LINUX_TARGET="mips-linux-gnu" 308 HELENOS_TARGET="mips-helenos" 309 ;; 310 "mips64") 311 LINUX_TARGET="mips64el-linux-gnu" 312 HELENOS_TARGET="mips64el-helenos" 313 ;; 314 "ppc32") 315 LINUX_TARGET="ppc-linux-gnu" 316 HELENOS_TARGET="ppc-helenos" 317 ;; 318 "ppc64") 319 LINUX_TARGET="ppc64-linux-gnu" 320 HELENOS_TARGET="ppc64-helenos" 321 ;; 322 "riscv64") 323 LINUX_TARGET="riscv64-unknown-linux-gnu" 324 HELENOS_TARGET="riscv64-helenos" 325 ;; 326 "sparc64") 327 LINUX_TARGET="sparc64-linux-gnu" 328 HELENOS_TARGET="sparc64-helenos" 245 LINUX_TARGET="${GNU_ARCH}-linux-gnueabi" 329 246 ;; 330 247 *) 331 check_error 1 "No target known for $1."248 LINUX_TARGET="${GNU_ARCH}-linux-gnu" 332 249 ;; 333 250 esac … … 355 272 fi 356 273 274 if [ -z "$JOBS" ] ; then 275 JOBS=`nproc` 276 fi 277 357 278 PREFIX="${CROSS_PREFIX}/${TARGET}" 358 279 … … 362 283 check_dirs "${PREFIX}" "${WORKDIR}" 363 284 285 if $USE_HELENOS_TARGET ; then 286 echo ">>> Creating build sysroot" 287 mkdir -p "${WORKDIR}/sysroot/include" 288 mkdir "${WORKDIR}/sysroot/lib" 289 cp -r -L -t "${WORKDIR}/sysroot/include" \ 290 ${SRCDIR}/../abi/include/* \ 291 ${SRCDIR}/../uspace/lib/c/arch/${PLATFORM}/include/* \ 292 ${SRCDIR}/../uspace/lib/c/include/* 293 check_error $? "Failed to create build sysroot." 294 fi 295 364 296 echo ">>> Processing binutils (${PLATFORM})" 365 297 mkdir -p "${BINUTILSDIR}" … … 370 302 CFLAGS=-Wno-error "${BASEDIR}/downloads/binutils-${BINUTILS_VERSION}/configure" \ 371 303 "--target=${TARGET}" \ 372 "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" \ 373 --disable-nls --disable-werror --enable-gold \ 374 --enable-deterministic-archives 304 "--prefix=${PREFIX}" \ 305 "--program-prefix=${TARGET}-" \ 306 --disable-nls \ 307 --disable-werror \ 308 --enable-gold \ 309 --enable-deterministic-archives \ 310 --disable-gdb \ 311 --with-sysroot 375 312 check_error $? "Error configuring binutils." 376 313 377 314 change_title "binutils: make (${PLATFORM})" 378 make all 315 make all -j$JOBS 379 316 check_error $? "Error compiling binutils." 380 317 … … 389 326 check_error $? "Change directory failed." 390 327 328 if $USE_HELENOS_TARGET ; then 329 SYSROOT=--with-sysroot --with-build-sysroot="${WORKDIR}/sysroot" 330 else 331 SYSROOT=--without-headers 332 fi 333 391 334 change_title "GCC: configure (${PLATFORM})" 392 335 PATH="$PATH:${INSTALL_DIR}/${PREFIX}/bin" "${BASEDIR}/downloads/gcc-${GCC_VERSION}/configure" \ 393 336 "--target=${TARGET}" \ 394 "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" \ 395 --with-gnu-as --with-gnu-ld --disable-nls --disable-threads \ 396 --enable-languages=c,objc,c++,obj-c++ \ 397 --disable-multilib --disable-libgcj --without-headers \ 398 --disable-shared --enable-lto --disable-werror 337 "--prefix=${PREFIX}" \ 338 "--program-prefix=${TARGET}-" \ 339 --with-gnu-as \ 340 --with-gnu-ld \ 341 --disable-nls \ 342 --enable-languages=c,c++,go \ 343 --enable-lto \ 344 --disable-shared \ 345 --disable-werror \ 346 $SYSROOT 399 347 check_error $? "Error configuring GCC." 400 348 401 349 change_title "GCC: make (${PLATFORM})" 402 PATH="${PATH}:${PREFIX}/bin:${INSTALL_DIR}/${PREFIX}/bin" make all-gcc 350 PATH="${PATH}:${PREFIX}/bin:${INSTALL_DIR}/${PREFIX}/bin" make all-gcc -j$JOBS 403 351 check_error $? "Error compiling GCC." 352 353 if $USE_HELENOS_TARGET ; then 354 PATH="${PATH}:${PREFIX}/bin:${INSTALL_DIR}/${PREFIX}/bin" make all-target-libgcc -j$JOBS 355 check_error $? "Error compiling libgcc." 356 # TODO: needs some extra care 357 #PATH="${PATH}:${PREFIX}/bin:${INSTALL_DIR}/${PREFIX}/bin" make all-target-libatomic -j$JOBS 358 #check_error $? "Error compiling libatomic." 359 #PATH="${PATH}:${PREFIX}/bin:${INSTALL_DIR}/${PREFIX}/bin" make all-target-libstdc++-v3 -j$JOBS 360 #check_error $? "Error compiling libstdc++." 361 fi 404 362 405 363 change_title "GCC: install (${PLATFORM})" 406 364 PATH="${PATH}:${INSTALL_DIR}/${PREFIX}/bin" make install-gcc "DESTDIR=${INSTALL_DIR}" 365 if $USE_HELENOS_TARGET ; then 366 PATH="${PATH}:${INSTALL_DIR}/${PREFIX}/bin" make install-target-libgcc "DESTDIR=${INSTALL_DIR}" 367 #PATH="${PATH}:${INSTALL_DIR}/${PREFIX}/bin" make install-target-libatomic "DESTDIR=${INSTALL_DIR}" 368 #PATH="${PATH}:${INSTALL_DIR}/${PREFIX}/bin" make install-target-libstdc++-v3 "DESTDIR=${INSTALL_DIR}" 369 fi 407 370 check_error $? "Error installing GCC." 408 371 … … 416 379 PATH="$PATH:${INSTALL_DIR}/${PREFIX}/bin" "${BASEDIR}/downloads/gdb-${GDB_VERSION}/configure" \ 417 380 "--target=${TARGET}" \ 418 "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" \ 419 --enable-werror=no --without-guile 381 "--prefix=${PREFIX}" \ 382 "--program-prefix=${TARGET}-" \ 383 --enable-werror=no 420 384 check_error $? "Error configuring GDB." 421 385 422 386 change_title "GDB: make (${PLATFORM})" 423 PATH="${PATH}:${PREFIX}/bin:${INSTALL_DIR}/${PREFIX}/bin" make all 387 PATH="${PATH}:${PREFIX}/bin:${INSTALL_DIR}/${PREFIX}/bin" make all-gdb -j$JOBS 424 388 check_error $? "Error compiling GDB." 425 389 426 390 change_title "GDB: make (${PLATFORM})" 427 PATH="${PATH}:${INSTALL_DIR}/${PREFIX}/bin" make install "DESTDIR=${INSTALL_DIR}"391 PATH="${PATH}:${INSTALL_DIR}/${PREFIX}/bin" make install-gdb "DESTDIR=${INSTALL_DIR}" 428 392 check_error $? "Error installing GDB." 429 393
Note:
See TracChangeset
for help on using the changeset viewer.