diff options
author | Tobias Kortkamp <tobik@FreeBSD.org> | 2020-02-25 18:18:26 +0000 |
---|---|---|
committer | Tobias Kortkamp <tobik@FreeBSD.org> | 2020-02-25 18:18:26 +0000 |
commit | 9a0c608b30626c586561441715c67115988339ff (patch) | |
tree | ca308fbe95e5d28e6d77f7287e3c66fa47195db7 /lang/rust-bootstrap | |
parent | f827f03fb1fe53e09dc211eed31c4f184a4b1262 (diff) | |
download | ports-9a0c608b30626c586561441715c67115988339ff.tar.gz ports-9a0c608b30626c586561441715c67115988339ff.zip |
Notes
Diffstat (limited to 'lang/rust-bootstrap')
-rw-r--r-- | lang/rust-bootstrap/Makefile | 230 | ||||
-rw-r--r-- | lang/rust-bootstrap/distinfo | 19 | ||||
-rw-r--r-- | lang/rust-bootstrap/pkg-descr | 7 |
3 files changed, 256 insertions, 0 deletions
diff --git a/lang/rust-bootstrap/Makefile b/lang/rust-bootstrap/Makefile new file mode 100644 index 000000000000..605dab73798e --- /dev/null +++ b/lang/rust-bootstrap/Makefile @@ -0,0 +1,230 @@ +# $FreeBSD$ + +PORTNAME= rust +PORTVERSION= 1.41.0 +CATEGORIES= lang +MASTER_SITES= https://static.rust-lang.org/dist/:rust \ + LOCAL/tobik:armbase \ + LOCAL/tobik:base \ + https://download.freebsd.org/ftp/${_RUST_FBSD_SUBDIR_${FLAVOR}}/:base \ + LOCAL/tobik:powerpc64_gcc +# http://pkg.freebsd.org/FreeBSD:12:powerpc64/quarterly/All/gcc9-9.2.0.txz?dummy=/:powerpc64_gcc +PKGNAMESUFFIX= -bootstrap +DISTNAME= ${PORTNAME}c-${PORTVERSION}-src +DISTFILES= rust/${DISTNAME}${EXTRACT_SUFX}:rust \ + ${_RUST_FBSD_DIST_${FLAVOR}} + +MAINTAINER= rust@FreeBSD.org +COMMENT= Create bootstrap compilers for building lang/rust + +LICENSE= APACHE20 MIT +LICENSE_COMB= dual +LICENSE_FILE_APACHE20= ${WRKSRC}/LICENSE-APACHE +LICENSE_FILE_MIT= ${WRKSRC}/LICENSE-MIT + +ONLY_FOR_ARCHS= amd64 +ONLY_FOR_ARCHS_REASON= untested on other archs + +BUILD_DEPENDS= cmake:devel/cmake \ + gmake:devel/gmake \ + rust>=${PORTVERSION}:lang/rust + +FLAVORS= aarch64 amd64 armv6 armv7 i386 powerpc64_elfv1 powerpc64_elfv2 +FLAVOR?= ${FLAVORS:[1]} + +aarch64_PKGNAMEPREFIX= aarch64- +amd64_PKGNAMEPREFIX= amd64- +armv6_PKGNAMEPREFIX= armv6- +armv7_PKGNAMEPREFIX= armv7- +i386_PKGNAMEPREFIX= i386- +powerpc64_elfv1_PKGNAMEPREFIX= powerpc64-elfv1- +powerpc64_elfv1_BUILD_DEPENDS= powerpc64-gcc9>0:devel/freebsd-gcc9@powerpc64 +powerpc64_elfv2_PKGNAMEPREFIX= powerpc64-elfv2- + +USES= perl5 python:3.3+,build tar:xz +.if ${FLAVOR} == powerpc64_elfv1 +USE_GCC= yes +.endif +# for openssl-src crate +USE_PERL5= build +PATCHDIR= ${.CURDIR}/../rust/files +# Resulting packages are not specific to amd64 +NO_ARCH= yes + +_RUST_FBSD_DIST_aarch64= FreeBSD-${_RUST_FBSD_VER}-arm64${EXTRACT_SUFX}:base +_RUST_FBSD_DIST_amd64= FreeBSD-${_RUST_FBSD_VER}-amd64${EXTRACT_SUFX}:base +# base.txz for armv* created from WANDBOARD images as there seem +# to be no generic base.txz for it. +_RUST_FBSD_DIST_armv6= FreeBSD-${_RUST_FBSD_VER}-arm-armv6${EXTRACT_SUFX}:armbase +_RUST_FBSD_DIST_armv7= FreeBSD-${_RUST_FBSD_VER}-arm-armv7${EXTRACT_SUFX}:armbase +_RUST_FBSD_DIST_i386= FreeBSD-${_RUST_FBSD_VER}-i386${EXTRACT_SUFX}:base +_RUST_FBSD_DIST_powerpc64_elfv1= FreeBSD-${_RUST_FBSD_VER}-powerpc64-elfv1${EXTRACT_SUFX}:base \ + FreeBSD-${_RUST_FBSD_VER}-powerpc64-elfv1-gcc9-9.2.0${EXTRACT_SUFX}:powerpc64_gcc +_RUST_FBSD_DIST_powerpc64_elfv2= FreeBSD-${_RUST_FBSD_VER}-powerpc64-elfv2-r356261${EXTRACT_SUFX}:base +_RUST_FBSD_VER= ${_RUST_FBSD_VER_${FLAVOR}:U11.3-RELEASE} +_RUST_FBSD_VER_armv7= 12.1-RELEASE +_RUST_FBSD_VER_powerpc64_elfv1= 12.1-RELEASE +_RUST_FBSD_VER_powerpc64_elfv2= 13.0-CURRENT +_RUST_FBSD_SUBDIR_aarch64= releases/arm64/${_RUST_FBSD_VER}/base.txz?dummy= +_RUST_FBSD_SUBDIR_amd64= releases/amd64/${_RUST_FBSD_VER}/base.txz?dummy= +_RUST_FBSD_SUBDIR_i386= releases/i386/${_RUST_FBSD_VER}/base.txz?dummy= +_RUST_FBSD_SUBDIR_powerpc64_elfv1= releases/powerpc/powerpc64/${_RUST_FBSD_VER}/base.txz?dummy= +_RUST_FBSD_SUBDIR_powerpc64_elfv2= snapshots/powerpc/powerpc64/${_RUST_FBSD_VER}/base.txz?dummy= + +_CARGO_VENDOR_DIR= ${WRKSRC}/vendor +_RUST_ARCH_amd64= x86_64 +_RUST_ARCH_i386= i686 +_RUST_ARCH_powerpc64_elfv1= powerpc64 +_RUST_ARCH_powerpc64_elfv2= powerpc64 +_RUST_HOST= ${_RUST_ARCH_${ARCH}:U${ARCH}}-unknown-${OPSYS:tl} +_RUST_TARGET= ${_RUST_ARCH_${FLAVOR}:U${FLAVOR}}-unknown-${OPSYS:tl} +_RUST_LLVM_TARGET= ${_RUST_LLVM_TARGET_${FLAVOR}} +_RUST_LLVM_TARGET_aarch64= AArch64 +_RUST_LLVM_TARGET_amd64= X86 +_RUST_LLVM_TARGET_armv6= ARM +_RUST_LLVM_TARGET_armv7= ARM +_RUST_LLVM_TARGET_i386= X86 +_RUST_LLVM_TARGET_powerpc64_elfv1= PowerPC +_RUST_LLVM_TARGET_powerpc64_elfv2= PowerPC +_RUST_LLVM_TRIPLE= ${_RUST_LLVM_TRIPLE_${FLAVOR}:U${_RUST_TARGET}} +_RUST_LLVM_TRIPLE_armv6= armv6-gnueabihf-freebsd +_RUST_LLVM_TRIPLE_armv7= armv7-gnueabihf-freebsd + +.include <bsd.port.pre.mk> + +.if ${OPSYS} != FreeBSD +IGNORE= is only for FreeBSD +.elif ${OSVERSION} < 1200502 +IGNORE= will not build on 12.0 due to old toolchain; 11.x untested +.endif + +.if exists(${PATCHDIR}/${FLAVOR:S/_/-/}) +EXTRA_PATCHES+= ${PATCHDIR}/${FLAVOR:S/_/-/} +.endif + +post-patch: +# Disable vendor checksums + @${REINPLACE_CMD} 's,"files":{[^}]*},"files":{},' \ + ${_CARGO_VENDOR_DIR}/*/.cargo-checksum.json +.if ${FLAVOR:Mpowerpc64_*} + @${REINPLACE_CMD} -e 's,powerpc64-unknown-freebsd,${_RUST_TARGET}${_RUST_FBSD_VER:S/-/ /:[1]},' \ + ${WRKSRC}/src/librustc_target/spec/powerpc64_unknown_freebsd.rs +.endif +.if ${FLAVOR} == powerpc64_elfv1 + @${REINPLACE_CMD} -e 's,"c++","stdc++",g' \ + ${WRKSRC}/src/librustc_llvm/build.rs +.endif + @${REINPLACE_CMD} -e 's,%CC%,${CC},g' \ + -e 's,%WRKDIR%,${WRKDIR},g' \ + ${WRKSRC}/src/librustc_llvm/build.rs \ + ${WRKSRC}/src/bootstrap/native.rs + +do-configure: +# Check that the running kernel has COMPAT_FREEBSD11 required by lang/rust post-ino64 + @${SETENV} CC="${CC}" OPSYS="${OPSYS}" OSVERSION="${OSVERSION}" WRKDIR="${WRKDIR}" \ + ${SH} ${SCRIPTSDIR}/rust-compat11-canary.sh + @${ECHO_CMD} '[build]' > ${WRKSRC}/config.toml + @${ECHO_CMD} 'vendor=true' >> ${WRKSRC}/config.toml + @${ECHO_CMD} 'extended=false' >> ${WRKSRC}/config.toml + @${ECHO_CMD} 'python="${PYTHON_CMD}"' >> ${WRKSRC}/config.toml + @${ECHO_CMD} 'docs=false' >> ${WRKSRC}/config.toml + @${ECHO_CMD} 'verbose=2' >> ${WRKSRC}/config.toml + @${ECHO_CMD} 'cargo-native-static=true' >> ${WRKSRC}/config.toml + @${ECHO_CMD} 'cargo="${LOCALBASE}/bin/cargo"' >> ${WRKSRC}/config.toml + @${ECHO_CMD} 'rustc="${LOCALBASE}/bin/rustc"' >> ${WRKSRC}/config.toml +.if ${_RUST_HOST} != ${_RUST_TARGET} + @${ECHO_CMD} 'host=["${_RUST_HOST}","${_RUST_TARGET}"]' >> ${WRKSRC}/config.toml + @${ECHO_CMD} 'target=["${_RUST_TARGET}"]' >> ${WRKSRC}/config.toml +.endif + @${ECHO_CMD} '[rust]' >> ${WRKSRC}/config.toml + @${ECHO_CMD} 'channel="stable"' >> ${WRKSRC}/config.toml + @${ECHO_CMD} 'default-linker="${CC}"' >> ${WRKSRC}/config.toml + @${ECHO_CMD} '[llvm]' >> ${WRKSRC}/config.toml + @${ECHO_CMD} 'link-shared=false' >> ${WRKSRC}/config.toml +.if ${FLAVOR} == powerpc64_elfv1 + @${ECHO_CMD} 'static-libstdcpp=true' >> ${WRKSRC}/config.toml +.endif +.if defined(WITH_CCACHE_BUILD) && !defined(NO_CCACHE) + @${ECHO_CMD} 'ccache="${CCACHE_BIN}"' >> ${WRKSRC}/config.toml +.else + @${ECHO_CMD} 'ccache=false' >> ${WRKSRC}/config.toml +.endif +# we need to make sure to always build llvm with X86 support to get a +# host compiler that can build the host->target compiler + @${ECHO_CMD} 'targets="${_RUST_LLVM_TARGET};X86"' >> ${WRKSRC}/config.toml + @${ECHO_CMD} '[target.${_RUST_TARGET}]' >> ${WRKSRC}/config.toml + @${ECHO_CMD} 'cc="${WRKDIR}/${_RUST_TARGET}-cc"' >> ${WRKSRC}/config.toml + @${ECHO_CMD} 'cxx="${WRKDIR}/${_RUST_TARGET}-c++"' >> ${WRKSRC}/config.toml + @${ECHO_CMD} 'linker="${WRKDIR}/${_RUST_TARGET}-cc"' >> ${WRKSRC}/config.toml +.for _key _util in ar ${AR} ranlib ${RANLIB} + @bin="$$(which ${_util})"; \ + ${ECHO_CMD} "${_key}=\"$$bin\"" >> ${WRKSRC}/config.toml +.endfor +.if ${_RUST_HOST} != ${_RUST_TARGET} + @${ECHO_CMD} '[target.${_RUST_HOST}]' >> ${WRKSRC}/config.toml + @${ECHO_CMD} 'cc="${CC}"' >> ${WRKSRC}/config.toml + @${ECHO_CMD} 'cxx="${CXX}"' >> ${WRKSRC}/config.toml + @${ECHO_CMD} 'linker="${CC}"' >> ${WRKSRC}/config.toml +.endif + @${ECHO_CMD} '[dist]' >> ${WRKSRC}/config.toml + @${ECHO_CMD} 'src-tarball=false' >> ${WRKSRC}/config.toml +.if ${FLAVOR} == powerpc64_elfv1 + @${RLN} ${WRKDIR}${LOCALBASE}/lib/gcc9/libstdc++.a ${WRKDIR}/usr/lib/libstdc++.a + @${RLN} ${WRKDIR}${LOCALBASE}/lib/gcc9/libstdc++.a ${WRKDIR}/usr/lib/libc++.a + @gcc="$$(${ECHO_CMD} ${LOCALBASE}/bin/${_RUST_TARGET}*[0-9]-gcc9)"; \ + ${PRINTF} '#!/bin/sh\nexec %s --sysroot=${WRKDIR} -Wl,-rpath=${LOCALBASE}/lib/gcc9 -L${WRKDIR}${LOCALBASE}/lib/gcc9 "$$@"\n' "$${gcc}" \ + > ${WRKDIR}/${_RUST_TARGET}-cc + @gcc="$$(${ECHO_CMD} ${LOCALBASE}/bin/${_RUST_TARGET}*[0-9]-g++9)"; \ + cxxinc="/$$(cd ${WRKDIR} && ${ECHO_CMD} ${LOCALBASE:S,^/,,}/lib/gcc9/include/c++/powerpc64-*)"; \ + ${PRINTF} '#!/bin/sh\nexec %s --sysroot=${WRKDIR} -isystem=${LOCALBASE}/lib/gcc9/include/c++ -isystem=%s -Wl,-rpath=${LOCALBASE}/lib/gcc9 -L${WRKDIR}${LOCALBASE}/lib/gcc9 "$$@"\n' "$${gcc}" "$${cxxinc}" \ + > ${WRKDIR}/${_RUST_TARGET}-c++ +.elif ${FLAVOR} == powerpc64_elfv2 + @${PRINTF} '#!/bin/sh\nexec ${CC} --sysroot=${WRKDIR} -mabi=elfv2 --target=${_RUST_LLVM_TRIPLE} "$$@"\n' \ + > ${WRKDIR}/${_RUST_TARGET}-cc + @${PRINTF} '#!/bin/sh\nexec ${CXX} --sysroot=${WRKDIR} -mabi=elfv2 --target=${_RUST_LLVM_TRIPLE} -stdlib=libc++ "$$@"\n' \ + > ${WRKDIR}/${_RUST_TARGET}-c++ +.else + @${PRINTF} '#!/bin/sh\nexec ${CC} --sysroot=${WRKDIR} --target=${_RUST_LLVM_TRIPLE} "$$@"\n' \ + > ${WRKDIR}/${_RUST_TARGET}-cc + @${PRINTF} '#!/bin/sh\nexec ${CXX} --sysroot=${WRKDIR} --target=${_RUST_LLVM_TRIPLE} -stdlib=libc++ "$$@"\n' \ + > ${WRKDIR}/${_RUST_TARGET}-c++ +.endif + @${CHMOD} +x ${WRKDIR}/${_RUST_TARGET}-c* +# sanity check cross compilers. we cannot execute the result but +# at least check that it can link a simple program before going further. + @${PRINTF} '#include <stdio.h>\nint main(){return printf("hello\\n");}' | ${WRKDIR}/${_RUST_TARGET}-cc -o ${WRKDIR}/test-c -xc - +# produce some useful info for the build logs like what release/arch test-c is compiled for + @cd ${WRKDIR} && ${FILE} test-c && ${READELF} -A test-c + @${PRINTF} '#include <iostream>\nint main(){std::cout<<"hello"<<std::endl;return 0;}' | ${WRKDIR}/${_RUST_TARGET}-c++ -o ${WRKDIR}/test-c++ -xc++ - + +do-build: + @cd ${WRKSRC} && \ + ${SETENV} ${MAKE_ENV} ${PYTHON_CMD} x.py dist --jobs=${MAKE_JOBS_NUMBER} \ + cargo src/librustc src/libstd + +do-install: + @${MKDIR} ${STAGEDIR}${PREFIX}/rust-bootstrap + ${INSTALL_DATA} ${WRKSRC}/build/dist/*-${_RUST_TARGET}*${EXTRACT_SUFX} \ + ${STAGEDIR}${PREFIX}/rust-bootstrap +.if ${FLAVOR:Mpowerpc64_*} + @cd ${STAGEDIR}${PREFIX}/rust-bootstrap && for f in *${EXTRACT_SUFX}; do \ + ${MV} $$f $${f%%${EXTRACT_SUFX}}-${FLAVOR:S/_/ /:[2]}${EXTRACT_SUFX}; \ + done +.endif + @cd ${STAGEDIR}${PREFIX} && \ + ${FIND} rust-bootstrap -type f >> ${TMPPLIST} + +.if !defined(_RUST_MAKESUM_GUARD) +makesum: + ${MAKE} -D_RUST_MAKESUM_GUARD makesum FLAVOR=${FLAVORS:O:[1]} DISTINFO_FILE=${DISTINFO_FILE}.tmp +.for _flavor in ${FLAVORS:O:[2..-1]} + ${MAKE} -D_RUST_MAKESUM_GUARD makesum FLAVOR=${_flavor} DISTINFO_FILE=${DISTINFO_FILE}.${_flavor} + ${SED} 1d ${DISTINFO_FILE}.${_flavor} >> ${DISTINFO_FILE}.tmp + ${RM} ${DISTINFO_FILE}.${_flavor} +.endfor + ${AWK} '!seen[$$0]++' ${DISTINFO_FILE}.tmp > ${DISTINFO_FILE} + ${RM} ${DISTINFO_FILE}.tmp +.endif + +.include <bsd.port.post.mk> +RUN_DEPENDS:= ${RUN_DEPENDS:Ngcc*} diff --git a/lang/rust-bootstrap/distinfo b/lang/rust-bootstrap/distinfo new file mode 100644 index 000000000000..7a490c1b27ed --- /dev/null +++ b/lang/rust-bootstrap/distinfo @@ -0,0 +1,19 @@ +TIMESTAMP = 1580247906 +SHA256 (rust/rustc-1.41.0-src.tar.xz) = 38d6742e5c4c98a835de5d6e12a209e442fb3078a03b2c01bab6ea7afb25be6f +SIZE (rust/rustc-1.41.0-src.tar.xz) = 93763052 +SHA256 (FreeBSD-11.3-RELEASE-arm64.tar.xz) = 0c1ee2bdbec3b6b404edef6858f38f5cdacd727abc53b1dee23910cab939d0c1 +SIZE (FreeBSD-11.3-RELEASE-arm64.tar.xz) = 97990888 +SHA256 (FreeBSD-11.3-RELEASE-amd64.tar.xz) = 4599023ac136325b86f2fddeec64c1624daa83657e40b00b2ef944c81463a4ff +SIZE (FreeBSD-11.3-RELEASE-amd64.tar.xz) = 117877900 +SHA256 (FreeBSD-11.3-RELEASE-arm-armv6.tar.xz) = 1d8025c4a51f025211fb6b4b24ba26144906ff288694394c1c3b1c6e0011db03 +SIZE (FreeBSD-11.3-RELEASE-arm-armv6.tar.xz) = 46549572 +SHA256 (FreeBSD-12.1-RELEASE-arm-armv7.tar.xz) = 0292ce8186908b3e4b5eb5e5923e1f43d22fcb0ab7f6071b493fcc17d386deab +SIZE (FreeBSD-12.1-RELEASE-arm-armv7.tar.xz) = 83402220 +SHA256 (FreeBSD-11.3-RELEASE-i386.tar.xz) = 9c0adb8c34b7e11d277c2fb9354f7864d91a4620e5238d7eb9dbfe51601ed5cb +SIZE (FreeBSD-11.3-RELEASE-i386.tar.xz) = 94399236 +SHA256 (FreeBSD-12.1-RELEASE-powerpc64-elfv1.tar.xz) = 2223e22babc169260f9a3f03bbbaf926ef76b1c44d2e81fb172f907ab8fd7aac +SIZE (FreeBSD-12.1-RELEASE-powerpc64-elfv1.tar.xz) = 108905368 +SHA256 (FreeBSD-12.1-RELEASE-powerpc64-elfv1-gcc9-9.2.0.tar.xz) = fe208feb93a75e6043e1cd1b9e50be853858d6d600296aaf2b25b55525e58bb2 +SIZE (FreeBSD-12.1-RELEASE-powerpc64-elfv1-gcc9-9.2.0.tar.xz) = 38150240 +SHA256 (FreeBSD-13.0-CURRENT-powerpc64-elfv2-r356261.tar.xz) = db762f136e41dd3c6676d6dc104282be6d6d6684afb348506fc44ceccd43ce17 +SIZE (FreeBSD-13.0-CURRENT-powerpc64-elfv2-r356261.tar.xz) = 150455928 diff --git a/lang/rust-bootstrap/pkg-descr b/lang/rust-bootstrap/pkg-descr new file mode 100644 index 000000000000..aa316f6c491a --- /dev/null +++ b/lang/rust-bootstrap/pkg-descr @@ -0,0 +1,7 @@ +Rust is an open-source systems programming language that runs blazingly +fast, prevents almost all crashes, and eliminates data races. + +This port creates the required bootstrap compilers for building the +next version of lang/rust. + +WWW: https://www.rust-lang.org/ |