Hi, We recently discussed internally about having a subpackage that provide a binary bootstrap (for ports needing one), in order to avoid a too big gap between base changes and ports bootstrap regeneration.
I took lang/rust example for testing some prototype. It might cover some aspects but not all. I opted to generate a plain tarball located at /usr/local/lib/rustc-bootstrap-${MACHINE_ARCH}.tar - a tarball : instead of copying files to one directory (and have to deal with filename changes due to MAJOR/MINOR in libraries in the PLIST), I prefered to use a tarball. so the PLIST-bootstrap is simple: just a unique file with stable name. - a plain tarball : I didn't see strong need to generate a compressed tarball here. rust boostrap is using lzma compression and it is relatively ressource intensive. and as the package is also compressed, I prefered to stick with plain tarball. - tarball destination : I put the tarball under /usr/local/lib, without specific name for the filename (I just reused the one I have for lang/rust). If we want some uniformisation, it might be preferable to have a commun directory (/usr/local/lib/bootstrap/ or /usr/local/share/bootstrap/ for example), and a common pattern for the name (lang-rust.tar ?) - PLIST-boostrap with 'always-update' : as the content of the tarball might change without notice, due to library bump (in base, or in a ports dependency), I marked the package as 'always-update'. It might be useful or not. In pratice, nobody is expected to install this subpackage outside few porters. - the tarball is in the format that lang/rust will expect for building (all files under rustc-bootstrap-${MACHINE_ARCH}-${V}). It means that minimal post-processing would be required to use it for building the port (in fact, only lzma compression). I intent to change slightly the extract step of the port to have a tarball named rustc-bootstrap-${MACHINE_ARCH}-${V}-YYYYMMDD and an extract directory named rustc-bootstrap-${MACHINE_ARCH}-${V}. The date part would be used only to pin the right tarball. Any comments on the principe ? -- Sebastien Marie Index: Makefile =================================================================== RCS file: /cvs/ports/lang/rust/Makefile,v diff -u -p -r1.200 Makefile --- Makefile 2 Apr 2024 12:14:19 -0000 1.200 +++ Makefile 4 Apr 2024 06:54:01 -0000 @@ -12,6 +12,7 @@ COMMENT-main = compiler for Rust Langua COMMENT-gdb = Rust debugger through gdb COMMENT-clippy = Rust linter COMMENT-rustfmt = Rust code formatter +COMMENT-bootstrap = Rust binary bootstrap COMMENT-src = Rust source component V = 1.77.1 @@ -31,9 +32,10 @@ PKGNAME-main = rust-${V} PKGNAME-gdb = rust-gdb-${V} PKGNAME-clippy = rust-clippy-${V} PKGNAME-rustfmt = rust-rustfmt-${V} +PKGNAME-bootstrap = rust-bootstrap-${V} PKGNAME-src = rust-src-${V} -MULTI_PACKAGES = -main -gdb -clippy -rustfmt -src +MULTI_PACKAGES = -main -gdb -clippy -rustfmt -bootstrap -src CATEGORIES = lang @@ -254,7 +256,7 @@ do-build: rust-std rustc cargo clippy rustfmt rust-src rm -rf -- ${WRKBUILD}/build/tmp -COMPONENTS ?= rustc-${V}-${TRIPLE_ARCH} \ +COMPONENTS = rustc-${V}-${TRIPLE_ARCH} \ rust-std-${V}-${TRIPLE_ARCH} \ cargo-${V}-${TRIPLE_ARCH} \ clippy-${V}-${TRIPLE_ARCH} \ @@ -284,6 +286,20 @@ do-install: ${TRIPLE_ARCH} \ ${LIBRUST_HASH} \ ${LIBRUST_REHASH} + # create a bootstrap tarball + cd ${PREFIX} && pax -w \ + -f ${PREFIX}/lib/rustc-bootstrap-${MACHINE_ARCH}.tar \ + -s ',^,rustc-bootstrap-${MACHINE_ARCH}-${V}/,' \ + bin/{rustc,rustdoc,cargo} \ + lib/lib*.so \ + lib/rustlib/${TRIPLE_ARCH}/ + cd ${PREFIX} && ldd bin/{rustc,rustdoc,cargo} \ + | sed -ne 's,.* \(/.*/lib/lib.*\.so.[.0-9]*\)$$,\1,p' \ + | sort -u \ + | pax -w -a \ + -f ${PREFIX}/lib/rustc-bootstrap-${MACHINE_ARCH}.tar \ + -s ',^/usr/lib/,rustc-bootstrap-${MACHINE_ARCH}-${V}/lib/,' \ + -s ',^/usr/local/lib/,rustc-bootstrap-${MACHINE_ARCH}-${V}/lib/,' # replace libraries by link for lib in ${PREFIX}/lib/lib*.* ; do \ libname=$${lib##*/} ; \ @@ -302,37 +318,5 @@ do-install: do-test: ${TEST_BIN} test --jobs=${MAKE_JOBS} --no-fail-fast - -STRIP ?= strip -# Try to avoid strip from our ancient binutils-2.17 -.if ${LINKER_VERSION} != "lld" -STRIP = llvm-strip-${MODCLANG_VERSION} -.endif - -# bootstrap target permits to regenerate the bootstrap archive -BOOTSTRAPNAME=rustc-bootstrap-${MACHINE_ARCH}-${V}-new -BOOTSTRAPDIR=${WRKDIR}/${BOOTSTRAPNAME} -bootstrap: build - ${_PBUILD} rm -rf ${BOOTSTRAPDIR} - ${_PBUILD} mkdir -p ${BOOTSTRAPDIR}/{bin,lib} - ${MAKE} clean=fake - ${MAKE} fake \ - PREFIX="${BOOTSTRAPDIR}" \ - COMPONENTS="rustc-${V}-${TRIPLE_ARCH} rust-std-${V}-${TRIPLE_ARCH} cargo-${V}-${TRIPLE_ARCH}" \ - FAKE_SETUP="" - ${_PBUILD} rm -rf ${BOOTSTRAPDIR}/{man,share} \ - ${BOOTSTRAPDIR}/bin/rust-gdb* - ${_PBUILD} ${STRIP} ${BOOTSTRAPDIR}/lib/lib*.so \ - ${BOOTSTRAPDIR}/lib/rustlib/${TRIPLE_ARCH}/lib/lib*.so -.for _bin in rustc rustdoc cargo - ${_PBUILD} ${STRIP} ${BOOTSTRAPDIR}/bin/${_bin} - ldd ${BOOTSTRAPDIR}/bin/${_bin} \ - | sed -ne 's,.* \(/.*/lib/lib.*\.so.[.0-9]*\)$$,\1,p' \ - | xargs -r -J % ${_PBUILD} cp % ${BOOTSTRAPDIR}/lib || true - ${BOOTSTRAPDIR}/bin/${_bin} -vV >/dev/null - ${_PBUILD} chmod -R a+rX ${BOOTSTRAPDIR} -.endfor - @echo '## to create a compressed tarball, use:' - @echo '$ tarlz --solid --anonymous -cf ${FULLDISTDIR}/${BOOTSTRAPNAME}.tar.lz ${BOOTSTRAPNAME}' .include <bsd.port.mk> Index: pkg/DESCR-bootstrap =================================================================== RCS file: pkg/DESCR-bootstrap diff -N pkg/DESCR-bootstrap --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ pkg/DESCR-bootstrap 4 Apr 2024 06:54:01 -0000 @@ -0,0 +1,6 @@ +Prepared tarball for bootstrapping lang/rust. + +To generate a suitable bootstrap archive for lang/rust, use: + +$ tarlz --solid -z ${PREFIX}/lib/rustc-bootstrap-${MACHINE_ARCH}.tar \ + -o rustc-bootstrap-${MACHINE_ARCH}-${V}-YYYYMMDD.tar.lz Index: pkg/PLIST-bootstrap =================================================================== RCS file: pkg/PLIST-bootstrap diff -N pkg/PLIST-bootstrap --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ pkg/PLIST-bootstrap 4 Apr 2024 06:54:01 -0000 @@ -0,0 +1,2 @@ +@option always-update +lib/rustc-bootstrap-${MACHINE_ARCH}.tar