|
| 1 | +#!/usr/bin/bash |
| 2 | +# |
| 3 | +# {{{ CDDL HEADER |
| 4 | +# |
| 5 | +# This file and its contents are supplied under the terms of the |
| 6 | +# Common Development and Distribution License ("CDDL"), version 1.0. |
| 7 | +# You may only use this file in accordance with the terms of version |
| 8 | +# 1.0 of the CDDL. |
| 9 | +# |
| 10 | +# A full copy of the text of the CDDL should have accompanied this |
| 11 | +# source. A copy of the CDDL is also available via the Internet at |
| 12 | +# http://www.illumos.org/license/CDDL. |
| 13 | +# }}} |
| 14 | + |
| 15 | +# Copyright 2024 OmniOS Community Edition (OmniOSce) Association. |
| 16 | + |
| 17 | +. ../../lib/build.sh |
| 18 | + |
| 19 | +PROG=rust |
| 20 | +PKG=ooce/developer/rust |
| 21 | +VER=1.83.0 |
| 22 | +SUMMARY="Rust systems programming language" |
| 23 | +DESC="Rust is a systems programming language that runs blazingly fast, " |
| 24 | +DESC+="prevents segfaults, and guarantees thread safety." |
| 25 | + |
| 26 | +set_builddir ${PROG}c-${VER}-src |
| 27 | + |
| 28 | +OPREFIX=$PREFIX |
| 29 | +PREFIX+=/$PROG |
| 30 | + |
| 31 | +BUILD_DEPENDS_IPS="developer/gnu-binutils" |
| 32 | +# TODO: globbing only works reliably as long as we just have |
| 33 | +# one cross compiler version per arch. |
| 34 | +crossgccver=`pkg_ver aarch64/gcc*` |
| 35 | +crossgccver=${crossgccver%%.*} |
| 36 | +# `rustc` uses `gcc` as its linker. Other dependencies such as the C runtime |
| 37 | +# and linker are themselves pulled in as dependencies of the gcc package. |
| 38 | +RUN_DEPENDS_IPS="developer/gcc$crossgccver" |
| 39 | + |
| 40 | +# rust build requires the final install directory to be present |
| 41 | +[ -d "$PREFIX" ] || logcmd $PFEXEC mkdir -p $PREFIX |
| 42 | + |
| 43 | +XFORM_ARGS=" |
| 44 | + -DPREFIX=${PREFIX#/} |
| 45 | + -DOPREFIX=${OPREFIX#/} |
| 46 | + -DPROG=$PROG |
| 47 | +" |
| 48 | + |
| 49 | +SKIP_RTIME_CHECK=1 |
| 50 | +SKIP_SSP_CHECK=1 |
| 51 | +NO_SONAME_EXPECTED=1 |
| 52 | + |
| 53 | +aarch64prefix=$CROSSTOOLS/aarch64/bin/${TRIPLETS[aarch64]} |
| 54 | +CONFIGURE_OPTS[aarch64]=" |
| 55 | + --prefix=$PREFIX |
| 56 | + --sysconfdir=/etc$PREFIX |
| 57 | + --localstatedir=/var$PREFIX |
| 58 | + --set target.${RUSTTRIPLETS[aarch64]}.cc=$aarch64prefix-gcc |
| 59 | + --set target.${RUSTTRIPLETS[aarch64]}.cxx=$aarch64prefix-g++ |
| 60 | + --set target.${RUSTTRIPLETS[aarch64]}.ar=$aarch64prefix-ar |
| 61 | +" |
| 62 | +CONFIGURE_OPTS+=" |
| 63 | + --release-description=OmniOS/$RELVER |
| 64 | + --enable-vendor |
| 65 | + --enable-local-rust |
| 66 | + --enable-extended |
| 67 | + --build=${RUSTTRIPLETS[$BUILD_ARCH]} |
| 68 | + --host=${RUSTTRIPLETS[aarch64]} |
| 69 | + --target=${RUSTTRIPLETS[aarch64]} |
| 70 | + --enable-rpath |
| 71 | + --enable-ninja |
| 72 | + --disable-codegen-tests |
| 73 | + --disable-dist-src |
| 74 | + --disable-llvm-static-stdcpp |
| 75 | + --disable-docs |
| 76 | + --release-channel=stable |
| 77 | + --python=$PYTHON |
| 78 | +" |
| 79 | + |
| 80 | +pre_configure() { :; |
| 81 | + # rust needs to find the native gcc for bootstrapping |
| 82 | + set_gccver $DEFAULT_GCC_VER |
| 83 | + |
| 84 | + tripus=${RUSTTRIPLETS[aarch64]//-/_} |
| 85 | + tripuc=${tripus^^} |
| 86 | + export CARGO_TARGET_${tripuc}_RUSTFLAGS=" |
| 87 | + -C link-arg=--sysroot=${SYSROOT[aarch64]} |
| 88 | + " |
| 89 | + export CXXFLAGS_${tripus}="-mno-outline-atomics -mtls-dialect=trad" |
| 90 | +} |
| 91 | + |
| 92 | +pre_install() { |
| 93 | + logcmd $MKDIR -p $DESTDIR/$PREFIX || logerr "failed to create directory" |
| 94 | +} |
| 95 | + |
| 96 | +init |
| 97 | +download_source $PROG ${PROG}c $VER-src |
| 98 | +patch_source |
| 99 | +prep_build autoconf-like |
| 100 | +build -noctf |
| 101 | +make_package |
| 102 | +clean_up |
| 103 | + |
| 104 | +# Vim hints |
| 105 | +# vim:ts=4:sw=4:et:fdm=marker |
0 commit comments