Sun Jan 3 21:54:09 2021 UTC ()
Further reduction of diffs with wip/rust/Makefile.


(he)
diff -r1.215 -r1.216 pkgsrc/lang/rust/Makefile

cvs diff -r1.215 -r1.216 pkgsrc/lang/rust/Makefile (expand / switch to unified diff)

--- pkgsrc/lang/rust/Makefile 2021/01/03 21:23:43 1.215
+++ pkgsrc/lang/rust/Makefile 2021/01/03 21:54:09 1.216
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: Makefile,v 1.215 2021/01/03 21:23:43 he Exp $ 1# $NetBSD: Makefile,v 1.216 2021/01/03 21:54:09 he Exp $
2 2
3DISTNAME= rustc-1.48.0-src 3DISTNAME= rustc-1.48.0-src
4PKGNAME= ${DISTNAME:S/rustc/rust/:S/-src//} 4PKGNAME= ${DISTNAME:S/rustc/rust/:S/-src//}
5CATEGORIES= lang 5CATEGORIES= lang
6MASTER_SITES= https://static.rust-lang.org/dist/ 6MASTER_SITES= https://static.rust-lang.org/dist/
7 7
8MAINTAINER= pkgsrc-users@NetBSD.org 8MAINTAINER= pkgsrc-users@NetBSD.org
9HOMEPAGE= https://www.rust-lang.org/ 9HOMEPAGE= https://www.rust-lang.org/
10COMMENT= Safe, concurrent, practical language 10COMMENT= Safe, concurrent, practical language
11LICENSE= mit OR apache-2.0 11LICENSE= mit OR apache-2.0
12 12
13CONFLICTS+= rust-bin-[0-9]* 13CONFLICTS+= rust-bin-[0-9]*
14 14
@@ -334,27 +334,26 @@ CKSUMS+= 5e252578b5d266f6a4c8dc9f71ca7a9 @@ -334,27 +334,26 @@ CKSUMS+= 5e252578b5d266f6a4c8dc9f71ca7a9
334 334
335CKSUM_CRATES+= vendor/stacker 335CKSUM_CRATES+= vendor/stacker
336CKSUMS+= cee329550bad2ed1182abb71db9c24558a91b12e1eab8d9a48e23b997bb8f04e 336CKSUMS+= cee329550bad2ed1182abb71db9c24558a91b12e1eab8d9a48e23b997bb8f04e
337CKSUMS+= 79915b243d02df1dc698f5c2de3a9356c6c296d2dedb06d9035dbcc2f8972cf4 337CKSUMS+= 79915b243d02df1dc698f5c2de3a9356c6c296d2dedb06d9035dbcc2f8972cf4
338 338
339CKSUM_CRATES+= vendor/net2 339CKSUM_CRATES+= vendor/net2
340CKSUMS+= fd072307ebbaa01cfe1fd7553d7f42d27093b2bd32dd81d419d2e1c9423495a0 340CKSUMS+= fd072307ebbaa01cfe1fd7553d7f42d27093b2bd32dd81d419d2e1c9423495a0
341CKSUMS+= 9e146a847e1f726fa7d7eae224aaa925030287f99770f950a012cb398e088d12 341CKSUMS+= 9e146a847e1f726fa7d7eae224aaa925030287f99770f950a012cb398e088d12
342 342
343CKSUM_CRATES+= vendor/openssl-src 343CKSUM_CRATES+= vendor/openssl-src
344CKSUMS+= 29499e62a2cde2fda48d21df58812ee5c198ef744522992bde8faae76747ac08 344CKSUMS+= 29499e62a2cde2fda48d21df58812ee5c198ef744522992bde8faae76747ac08
345CKSUMS+= e34f9921c6531d043f3516821442aaeda86c7912d40cbddaf79bba6b08c37952 345CKSUMS+= e34f9921c6531d043f3516821442aaeda86c7912d40cbddaf79bba6b08c37952
346 346
347 
348SUBST_CLASSES+= cksum 347SUBST_CLASSES+= cksum
349SUBST_STAGE.cksum= pre-configure 348SUBST_STAGE.cksum= pre-configure
350.for crate in ${CKSUM_CRATES} 349.for crate in ${CKSUM_CRATES}
351SUBST_FILES.cksum+= ${crate}/.cargo-checksum.json 350SUBST_FILES.cksum+= ${crate}/.cargo-checksum.json
352.endfor 351.endfor
353.for from to in ${CKSUMS} 352.for from to in ${CKSUMS}
354SUBST_SED.cksum+= -e 's,${from},${to},g' 353SUBST_SED.cksum+= -e 's,${from},${to},g'
355.endfor 354.endfor
356 355
357# Patchelf appears to create unrecognized binaries... 356# Patchelf appears to create unrecognized binaries...
358#.if ${OPSYS} == "NetBSD" 357#.if ${OPSYS} == "NetBSD"
359#TOOL_DEPENDS+= patchelf-[0-9]*:../../devel/patchelf 358#TOOL_DEPENDS+= patchelf-[0-9]*:../../devel/patchelf
360#PATCHELF= ${PREFIX}/bin/patchelf 359#PATCHELF= ${PREFIX}/bin/patchelf
@@ -398,57 +397,79 @@ post-extract: @@ -398,57 +397,79 @@ post-extract:
398MAKE_ENV+= OPENSSL_DIR=${SSLBASE} 397MAKE_ENV+= OPENSSL_DIR=${SSLBASE}
399.endif 398.endif
400 399
401.if ${OPSYS} == "NetBSD" && !empty(PKGSRC_COMPILER:Mclang) && !exists(/lib/libgcc_s.so) 400.if ${OPSYS} == "NetBSD" && !empty(PKGSRC_COMPILER:Mclang) && !exists(/lib/libgcc_s.so)
402BUILDLINK_TRANSFORM+= rm:-lgcc_s 401BUILDLINK_TRANSFORM+= rm:-lgcc_s
403MAKE_ENV+= PKGSRC_HAVE_LIBCPP=yes 402MAKE_ENV+= PKGSRC_HAVE_LIBCPP=yes
404.endif 403.endif
405 404
406pre-build: pre-build-fix 405pre-build: pre-build-fix
407.if ${OPSYS} == "NetBSD" && !empty(PKGSRC_COMPILER:Mclang) && !exists(/lib/libgcc_s.so) 406.if ${OPSYS} == "NetBSD" && !empty(PKGSRC_COMPILER:Mclang) && !exists(/lib/libgcc_s.so)
408 cp ${FILESDIR}/libgcc_s.so.1 ${RUST_BOOTSTRAP_PATH}/lib/. 407 cp ${FILESDIR}/libgcc_s.so.1 ${RUST_BOOTSTRAP_PATH}/lib/.
409.endif 408.endif
410 409
 410#
 411# These are essentially copies of the "all", "test", and "install" Makefile
 412# targets, but are duplicated here so that we can specify -j.
 413#
411do-build: 414do-build:
412 cd ${WRKSRC} \ 415 ${RUN}${_ULIMIT_CMD} \
413 && ${_ULIMIT_CMD} ${SETENV} ${INSTALL_ENV} ${MAKE_ENV} \ 416 cd ${WRKSRC} && \
414 sh -c "if [ \"${BUILD_TARGET}\" = \"dist\" ]; then \ 417 ${SETENV} ${MAKE_ENV} \
415 unset DESTDIR; \ 418 sh -c "if [ \"${BUILD_TARGET}\" = \"dist\" ]; then \
416 fi; \ 419 unset DESTDIR; \
417 ${PYTHONBIN} ./x.py -v ${BUILD_TARGET} -j ${_MAKE_JOBS_N}" 420 ${PYTHONBIN} ./x.py -v \
 421 ${BUILD_TARGET} -j ${_MAKE_JOBS_N}; \
 422 else \
 423 ${PYTHONBIN} ./x.py -v \
 424 ${BUILD_TARGET} --stage 2 -j ${_MAKE_JOBS_N} && \
 425 ${PYTHONBIN} ./x.py -v \
 426 doc --stage 2 -j ${_MAKE_JOBS_N}; \
 427 fi"
 428
 429do-test:
 430 ${RUN}${_ULIMIT_CMD} \
 431 cd ${WRKSRC} && \
 432 ${SETENV} ${MAKE_ENV} \
 433 ${PYTHONBIN} ./x.py -v test -j ${_MAKE_JOBS_N}
418 434
419do-install: 435do-install:
420 cd ${WRKSRC} \ 436 ${RUN}${_ULIMIT_CMD} \
421 && ${_ULIMIT_CMD} ${SETENV} ${INSTALL_ENV} ${MAKE_ENV} \ 437 cd ${WRKSRC} && \
 438 ${SETENV} ${MAKE_ENV} ${INSTALL_ENV} \
422 ${PYTHONBIN} ./x.py -v install -j ${_MAKE_JOBS_N} 439 ${PYTHONBIN} ./x.py -v install -j ${_MAKE_JOBS_N}
423 440
424.if ${OPSYS} == "Darwin" 441.if ${OPSYS} == "Darwin"
425.PHONY: fix-darwin-install-name 442.PHONY: fix-darwin-install-name
426post-install: fix-darwin-install-name 443post-install: fix-darwin-install-name
427fix-darwin-install-name: 444fix-darwin-install-name:
428 for f in ${DESTDIR}${PREFIX}/lib/librustc_macros-*.dylib \ 445 for f in ${DESTDIR}${PREFIX}/lib/librustc_macros-*.dylib \
429 ${DESTDIR}${PREFIX}/lib/libtracing_attributes-*.dylib \ 446 ${DESTDIR}${PREFIX}/lib/libtracing_attributes-*.dylib \
430 ${DESTDIR}${PREFIX}/lib/libchalk_derive-*.dylib; do \ 447 ${DESTDIR}${PREFIX}/lib/libchalk_derive-*.dylib; do \
431 install_name_tool -id `${ECHO} $$f | ${SED} -e 's,${DESTDIR},,g'` $$f; \ 448 install_name_tool -id `${ECHO} $$f | ${SED} -e 's,${DESTDIR},,g'` $$f; \
432 done 449 done
433.endif 450.endif
434 451
435GENERATE_PLIST+= ${FIND} ${DESTDIR}${PREFIX} \( -type f -o -type l \) -print | \ 452GENERATE_PLIST+= ${FIND} ${DESTDIR}${PREFIX} \( -type f -o -type l \) -print | \
436 ${SED} -e 's,${DESTDIR}${PREFIX}/,,' | ${SORT} ; 453 ${SED} -e 's,${DESTDIR}${PREFIX}/,,' | ${SORT} ;
437 454
438# Create a relocatable stage2 bootstrap from the bits we just built that can be 455# Create a relocatable stage2 bootstrap from the bits we just built that can be
439# used to build the next version of rust. Currently only tested on SmartOS. 456# used to build the next version of rust. Currently only tested on SmartOS.
440# 457#
441BOOTSTRAP_TMPDIR= ${WRKDIR}/${PKGNAME_NOREV}-${RUST_ARCH} 458# Use the alternate BOOTSTRAP_NAME when creating a nightly release.
 459#
 460#BOOTSTRAP_NAME= ${PKGNAME_NOREV:C/rust/rust-nightly/}-${RUST_ARCH}
 461BOOTSTRAP_NAME= ${PKGNAME_NOREV}-${RUST_ARCH}
 462BOOTSTRAP_TMPDIR= ${WRKDIR}/${BOOTSTRAP_NAME}
442USE_TOOLS+= gtar 463USE_TOOLS+= gtar
443 464
444# The NetBSD part is so far untested, because I could not convince 465# The NetBSD part is so far untested, because I could not convince
445# the rust build to use the gcc wrapper when building natively, 466# the rust build to use the gcc wrapper when building natively,
446# so that I could get a placeholder in the RPATH, because chrpath 467# so that I could get a placeholder in the RPATH, because chrpath
447# cannot extend the length of the RPATH... 468# cannot extend the length of the RPATH...
448ELFEDIT?= /usr/bin/elfedit 469ELFEDIT?= /usr/bin/elfedit
449 470
450.PHONY: stage0-bootstrap 471.PHONY: stage0-bootstrap
451stage0-bootstrap: install 472stage0-bootstrap: install
452 ${RM} -rf ${BOOTSTRAP_TMPDIR} 473 ${RM} -rf ${BOOTSTRAP_TMPDIR}
453 ${MKDIR} ${BOOTSTRAP_TMPDIR} 474 ${MKDIR} ${BOOTSTRAP_TMPDIR}
454.if ${OPSYS} == "NetBSD" 475.if ${OPSYS} == "NetBSD"
@@ -478,52 +499,52 @@ stage0-bootstrap: install @@ -478,52 +499,52 @@ stage0-bootstrap: install
478 ${ECHO} "Fixed stage0 bootstrap in ${BOOTSTRAP_TMPDIR}:"; \ 499 ${ECHO} "Fixed stage0 bootstrap in ${BOOTSTRAP_TMPDIR}:"; \
479 ${ECHO} "$${RUSTC_FILE}"; \ 500 ${ECHO} "$${RUSTC_FILE}"; \
480 ${ECHO} "$${RUST_STD_FILE}"; \ 501 ${ECHO} "$${RUST_STD_FILE}"; \
481 ) 502 )
482.endif 503.endif
483.if ${OS_VARIANT} == "SmartOS" 504.if ${OS_VARIANT} == "SmartOS"
484 ${CP} -R ${DESTDIR}/${PREFIX}/bin ${BOOTSTRAP_TMPDIR}/ 505 ${CP} -R ${DESTDIR}/${PREFIX}/bin ${BOOTSTRAP_TMPDIR}/
485 ${CP} -R ${DESTDIR}/${PREFIX}/lib ${BOOTSTRAP_TMPDIR}/ 506 ${CP} -R ${DESTDIR}/${PREFIX}/lib ${BOOTSTRAP_TMPDIR}/
486 ${MKDIR} ${BOOTSTRAP_TMPDIR}/lib/pkgsrc 507 ${MKDIR} ${BOOTSTRAP_TMPDIR}/lib/pkgsrc
487 for lib in libgcc_s.so.1 libssp.so.0 libstdc++.so.6; do \ 508 for lib in libgcc_s.so.1 libssp.so.0 libstdc++.so.6; do \
488 ${CP} `${PKG_CC} -print-file-name=$${lib}` \ 509 ${CP} `${PKG_CC} -print-file-name=$${lib}` \
489 ${BOOTSTRAP_TMPDIR}/lib/pkgsrc/; \ 510 ${BOOTSTRAP_TMPDIR}/lib/pkgsrc/; \
490 done 511 done
491 : direct dependencies 512 # direct dependencies
492 for lib in libLLVM-10.so libcrypto.so.1.1 libcurl.so.4 \ 513 for lib in libLLVM-10.so libcrypto.so.1.1 libcurl.so.4 \
493 libssl.so.1.1 libz.so.1; do \ 514 libssl.so.1.1 libz.so.1; do \
494 ${CP} ${PREFIX}/lib/$${lib} ${BOOTSTRAP_TMPDIR}/lib/pkgsrc/; \ 515 ${CP} ${PREFIX}/lib/$${lib} ${BOOTSTRAP_TMPDIR}/lib/pkgsrc/; \
495 done 516 done
496 : libcurl dependencies 517 # libcurl dependencies
497 for lib in libiconv.so.2 libidn2.so.0 libintl.so.8 liblber-2.4.so.2 \ 518 for lib in libiconv.so.2 libidn2.so.0 libintl.so.8 liblber-2.4.so.2 \
498 libldap-2.4.so.2 libnghttp2.so.14 libsasl2.so.3 \ 519 libldap-2.4.so.2 libnghttp2.so.14 libsasl2.so.3 \
499 libssh2.so.1 libunistring.so.2; do \ 520 libssh2.so.1 libunistring.so.2; do \
500 ${CP} ${PREFIX}/lib/$${lib} ${BOOTSTRAP_TMPDIR}/lib/pkgsrc/; \ 521 ${CP} ${PREFIX}/lib/$${lib} ${BOOTSTRAP_TMPDIR}/lib/pkgsrc/; \
501 done 522 done
502 for f in ${BOOTSTRAP_TMPDIR}/bin/*; do \ 523 for f in ${BOOTSTRAP_TMPDIR}/bin/*; do \
503 /bin/file -b "$$f" | grep ^ELF >/dev/null || continue; \ 524 /bin/file -b "$$f" | grep ^ELF >/dev/null || continue; \
504 ${ELFEDIT} -e 'dyn:runpath $$ORIGIN/../lib:$$ORIGIN/../lib/pkgsrc' $$f; \ 525 ${ELFEDIT} -e 'dyn:runpath $$ORIGIN/../lib:$$ORIGIN/../lib/pkgsrc' $$f; \
505 done 526 done
506 for f in ${BOOTSTRAP_TMPDIR}/lib/pkgsrc/*.so*; do \ 527 for f in ${BOOTSTRAP_TMPDIR}/lib/pkgsrc/*.so*; do \
507 ${ELFEDIT} -e 'dyn:runpath $$ORIGIN' $$f; \ 528 ${ELFEDIT} -e 'dyn:runpath $$ORIGIN' $$f; \
508 done 529 done
509 for f in ${BOOTSTRAP_TMPDIR}/lib/*.so*; do \ 530 for f in ${BOOTSTRAP_TMPDIR}/lib/*.so*; do \
510 ${ELFEDIT} -e 'dyn:runpath $$ORIGIN:$$ORIGIN/pkgsrc' $$f; \ 531 ${ELFEDIT} -e 'dyn:runpath $$ORIGIN:$$ORIGIN/pkgsrc' $$f; \
511 done 532 done
512 for f in ${BOOTSTRAP_TMPDIR}/lib/rustlib/*/*/*.so*; do \ 533 for f in ${BOOTSTRAP_TMPDIR}/lib/rustlib/*/*/*.so*; do \
513 ${ELFEDIT} -e 'dyn:runpath $$ORIGIN:$$ORIGIN/../../..:$$ORIGIN/../../../pkgsrc' $$f; \ 534 ${ELFEDIT} -e 'dyn:runpath $$ORIGIN:$$ORIGIN/../../..:$$ORIGIN/../../../pkgsrc' $$f; \
514 done 535 done
515 (cd ${WRKDIR}; \ 536 (cd ${WRKDIR}; \
516 ${GTAR} -zcf ${PKGNAME_NOREV}-${RUST_ARCH}.tar.gz ${PKGNAME_NOREV}-${RUST_ARCH}) 537 ${GTAR} -zcf ${BOOTSTRAP_NAME}.tar.gz ${BOOTSTRAP_NAME})
517.endif 538.endif
518 539
519.include "options.mk" 540.include "options.mk"
520 541
521# These dependencies currently use the bundled sources as they require 542# These dependencies currently use the bundled sources as they require
522# development features not yet available in released versions. 543# development features not yet available in released versions.
523# 544#
524#.include "../../devel/libgit2/buildlink3.mk" 545#.include "../../devel/libgit2/buildlink3.mk"
525#.include "../../security/libssh2/buildlink3.mk" 546#.include "../../security/libssh2/buildlink3.mk"
526#.include "../../www/http-parser/buildlink3.mk" 547#.include "../../www/http-parser/buildlink3.mk"
527#.include "../../devel/jemalloc/buildlink3.mk" 548#.include "../../devel/jemalloc/buildlink3.mk"
528 549
529## Issues specific to: bootstrap AND NetBSD follow 550## Issues specific to: bootstrap AND NetBSD follow
@@ -535,46 +556,41 @@ stage0-bootstrap: install @@ -535,46 +556,41 @@ stage0-bootstrap: install
535.if (${OPSYS} == "NetBSD") && \ 556.if (${OPSYS} == "NetBSD") && \
536 ((${MACHINE_ARCH} == "i386") || \ 557 ((${MACHINE_ARCH} == "i386") || \
537 (${MACHINE_ARCH} == "sparc64") || \ 558 (${MACHINE_ARCH} == "sparc64") || \
538 (${MACHINE_ARCH} == "powerpc")) \ 559 (${MACHINE_ARCH} == "powerpc")) \
539 && (empty(OS_VERSION:M[012345678].*) || \ 560 && (empty(OS_VERSION:M[012345678].*) || \
540 !empty(OS_VERSION:M8.99.*)) 561 !empty(OS_VERSION:M8.99.*))
541# Bootstrap kits are built on 8.0, so that a single bootstrap can run 562# Bootstrap kits are built on 8.0, so that a single bootstrap can run
542# on multiple systems. Thus later versions need the compat80 package. 563# on multiple systems. Thus later versions need the compat80 package.
543# \todo Explain why this is limited to a small list of architectures, 564# \todo Explain why this is limited to a small list of architectures,
544# and in particular why not x86_64. 565# and in particular why not x86_64.
545DEPENDS+= compat80>=0:../../emulators/compat80 566DEPENDS+= compat80>=0:../../emulators/compat80
546.endif 567.endif
547 568
548.if (${MACHINE_ARCH} == "powerpc") 
549# LLVM needs libatomic for 64-bit atomics on powerpc 
550.include "../../devel/libatomic/buildlink3.mk" 
551# Make those libraries available via a unique directory: 
552DEPENDS+= libatomic-links>=0:../../devel/libatomic-links 
553.endif 
554 
555.if (${OPSYS} == "NetBSD") && \ 569.if (${OPSYS} == "NetBSD") && \
556 ((${MACHINE_ARCH} == "i386")) \ 570 ((${MACHINE_ARCH} == "i386")) \
557 && (empty(OS_VERSION:M[012345678].*) || \ 571 && (empty(OS_VERSION:M[012345678].*) || \
558 !empty(OS_VERSION:M8.99.*)) 572 !empty(OS_VERSION:M8.99.*))
559# Bootstrap kits use openssl, which on NetBSD 8 comes from pkgsrc. 573# Bootstrap kits use openssl, which on NetBSD 8 comes from pkgsrc.
560# Therefore the pkgsrc openssl libs need to be present as well. 574# Therefore the pkgsrc openssl libs need to be present as well.
561# The 1.44.1 i686 bootstrap links with pkgsrc openssl. The others do 575# The 1.44.1 i686 bootstrap links with pkgsrc openssl. The others do
562# not. When the package is built, 576# not. When the package is built,
563# cargo links against pkgsrc openssl, so it must be a run-time 577# cargo links against pkgsrc openssl, so it must be a run-time
564# dependency as well. Forcing USE_BUILTIN.openssl=no results in a 578# dependency as well. Forcing USE_BUILTIN.openssl=no results in a
565# mysterious heimdal error, but straight DEPENDS seems to result in a 579# mysterious heimdal error, but straight DEPENDS seems to result in a
566# satisfactory package build. 580# satisfactory package build.
567# While this is icky, it is for the time being better than no rust package. 581# While this is icky, it is for the time being better than no rust package.
568DEPENDS+= openssl>=1.1:../../security/openssl 582DEPENDS+= openssl>=1.1:../../security/openssl
569.endif 583.endif
570 584
571# This is for when we build natively: 585# This is for when we build natively:
572.if ((${OPSYS} == "NetBSD") && \ 586.if ((${OPSYS} == "NetBSD") && \
573 ((${MACHINE_ARCH} == "powerpc") || (${MACHINE_ARCH} == "i386"))) 587 ((${MACHINE_ARCH} == "powerpc") || (${MACHINE_ARCH} == "i386")))
574# For 8-byte atomics, required by LLVM 588# LLVM needs libatomic for 64-bit atomics on powerpc and i386
575.include "../../devel/libatomic/buildlink3.mk" 589.include "../../devel/libatomic/buildlink3.mk"
 590# Make those libraries available via a unique directory:
 591DEPENDS+= libatomic-links>=0:../../devel/libatomic-links
576.endif 592.endif
577 593
578.include "../../devel/zlib/buildlink3.mk" 594.include "../../devel/zlib/buildlink3.mk"
579.include "../../lang/python/tool.mk" 595.include "../../lang/python/tool.mk"
580.include "../../mk/bsd.pkg.mk" 596.include "../../mk/bsd.pkg.mk"