1 # Created by: Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
5 PORTVERSION= 0.4.0.20150720
8 MAINTAINER= dumbbell@FreeBSD.org
9 COMMENT= Rust's Package Manager
10 # ' <-- Help Vim syntax hilighting...
15 LICENSE_FILE= ${WRKSRC}/LICENSE-APACHE \
18 # The following files are required:
20 # Main source archive from GitHub
21 # This is the source of Cargo, taken from GitHub.
24 # Like Rust, this is a prebuilt "cargo" used to bootstrap it, because
25 # Cargo is a standard Rust package itself.
28 # Cargo clones several Git repositories for its dependencies and
29 # caches them in its "registry". This is an archive of this registry
30 # so nothing is downloaded during the build.
33 # This is a collection of mainly shell scripts which are used to
36 MASTER_SITES= https://static.rust-lang.org/cargo-dist/2015-04-02/:bootstrap \
37 LOCAL/dumbbell:registry
39 DISTFILES= ${CARGO_BOOT}:bootstrap
40 EXTRACT_ONLY= ${DISTNAME}${_GITHUB_EXTRACT_SUFX} \
41 ${DISTFILE_rust_installer}
43 .if (${.TARGET} != gen-registry) && !defined(SKIP_CARGO_REGISTRY)
44 DISTFILES+= ${CARGO_REGISTRY}:registry
45 EXTRACT_ONLY+= ${CARGO_REGISTRY}
50 GH_PROJECT= ${PORTNAME} \
51 rust-installer:rust_installer
52 GH_TAGNAME= 9c5ffcb871 \
53 c37d374:rust_installer
55 CARGO_BOOT_SIG= x86_64-unknown-freebsd
56 CARGO_BOOT= ${PORTNAME}-nightly-${CARGO_BOOT_SIG}${EXTRACT_SUFX}
57 CARGO_REGISTRY= ${DISTNAME:S/${GH_ACCOUNT}-${PORTNAME}/${PORTNAME}-registry/}${EXTRACT_SUFX}
59 USES= gmake python:2,build pkgconfig
61 # The bootstrapped cargo is built with OpenSSL from ports (libssl.so.8).
65 # We don't USES=cmake here, because cmake is not Cargo's build system.
66 # It's used by a bundled dependency (libgit2).
67 BUILD_DEPENDS= ${LOCALBASE}/bin/cmake:${PORTSDIR}/devel/cmake \
68 rustc:${PORTSDIR}/lang/rust-nightly
69 LIB_DEPENDS= libssh2.so:${PORTSDIR}/security/libssh2 \
70 libcurl.so:${PORTSDIR}/ftp/curl
72 # FIXME: Don't add rust as a runtime dependency. As we need rust-nightly
73 # to build Cargo, the same version would be pulled by installing Cargo,
74 # preventing its use with the stable version of Rust.
75 # RUN_DEPENDS= rustc:${PORTSDIR}/lang/rust
78 CONFIGURE_ARGS= --mandir=${MANPREFIX}/man
79 MAKE_ENV+= LD_LIBRARY_PATH="${WRKSRC}/target/snapshot/cargo/lib"
81 # git log -1 --date=short --pretty=format:'%cd'
82 CFG_VER_DATE= ${PORTVERSION:C/.*\.([0-9]{4})([0-9]{2})([0-9]{2})/\1-\2-\3/}
83 # git rev-parse --short HEAD
84 CFG_VER_HASH= ${GH_TAGNAME}
86 .if defined(BATCH) || defined(PACKAGE_BUILDING)
92 .include <bsd.port.pre.mk>
95 @(${RMDIR} ${WRKSRC}/src/rust-installer && \
96 ${MV} ${WRKSRC_rust_installer} ${WRKSRC}/src/rust-installer)
97 @${MKDIR} ${WRKSRC}/target/dl
98 ${LN} -sf ${DISTDIR}/${CARGO_BOOT} ${WRKSRC}/target/dl/
102 -e 's|^CFG_VER_DATE =.*|CFG_VER_DATE = ${CFG_VER_DATE}|' \
103 -e 's|^CFG_VER_HASH =.*|CFG_VER_HASH = ${CFG_VER_HASH}|' \
104 ${WRKSRC}/Makefile.in
106 # In case the previous "make stage" failed, this ensures rust's
107 # install.sh won't backup previously staged files before reinstalling
108 # new ones. Otheriwe, the staging directory is polluted with unneeded
111 @if test -f ${STAGEDIR}${PREFIX}/lib/rustlib/manifest-cargo; then \
112 ${SED} -E -e 's,^(dir|file:),${STAGEDIR},' \
113 < ${STAGEDIR}${PREFIX}/lib/rustlib/manifest-cargo \
117 ${STAGEDIR}${PREFIX}/lib/rustlib/components \
118 ${STAGEDIR}${PREFIX}/lib/rustlib/manifest-cargo \
119 ${STAGEDIR}${PREFIX}/lib/rustlib/rust-installer-version \
120 ${STAGEDIR}${PREFIX}/lib/rustlib/uninstall.sh
123 @${RM} ${STAGEDIR}${PREFIX}/lib/rustlib/install.log
124 @${MV} ${STAGEDIR}${PREFIX}/share/man/man1/cargo.1 \
125 ${STAGEDIR}${PREFIX}/man/man1/cargo.1
126 @${RMDIR} ${STAGEDIR}${PREFIX}/share/man/man1 \
127 ${STAGEDIR}${PREFIX}/share/man
128 @${REINPLACE_CMD} -e 's|${STAGEDIR}||' \
129 -e 's|share/man/man1/cargo\.1|man/man1/cargo.1.gz|' \
130 ${STAGEDIR}${PREFIX}/lib/rustlib/manifest-cargo
131 @${RM} ${STAGEDIR}${PREFIX}/lib/rustlib/manifest-cargo.bak
132 @${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/cargo
134 ${STAGEDIR}${PREFIX}/lib/rustlib/components \
135 ${STAGEDIR}${PREFIX}/lib/rustlib/rust-installer-version \
136 ${STAGEDIR}${PREFIX}/lib/rustlib/uninstall.sh
138 # "make gen-registry" is a special target to ease this port update.
140 # After changing the version number and the Git revision, you can run
141 # "make registry" to update the distinfo and create a new snapshot of
142 # the registry. The new registry is written to ${DISTDIR} and can be
146 ${MAKE} -DSKIP_CARGO_REGISTRY makesum
147 ${MAKE} -DSKIP_CARGO_REGISTRY
150 --exclude libgit2/tests/ \
151 --exclude curl/tests/ \
152 --exclude 'index/github.com-*/.git/' \
153 .cargo | ${GZIP_CMD} > ${DISTDIR}/${CARGO_REGISTRY}
156 .include <bsd.port.post.mk>