Ticket #56451: Portfile

File Portfile, 16.6 KB (added by gaming-hacker (G Alexander), 6 years ago)

cargo portfile

Line 
1# -*- coding: utf-8; mode: _tcl; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- vim:fenc=utf-8:ft=portfile:et:sw=2:ts=2:sts=2
2
3PortSystem          1.0
4name                cargo
5if {${subport} ne "${name}-bootstrap"} {
6    PortGroup       github 1.0
7    github.setup    rust-lang ${name} 0.27.0
8} else {
9    version         0.24.0
10}
11PortGroup           cargo 1.0
12
13revision            1
14categories          devel
15platforms           darwin
16supported_archs     i386 x86_64
17license             {MIT Apache-2}
18maintainers         nomaintainer
19
20description         The Rust package manager
21
22long_description    Cargo downloads your Rust project’s dependencies and \
23                    compiles your project.
24
25homepage            https://crates.io
26
27installs_libs       no
28
29if {${subport} ne "${name}-bootstrap"} {
30    # can use cmake or cmake-devel; default to cmake.
31    depends_build   path:bin/cmake:cmake \
32                    bin:python:python27
33
34    depends_lib     path:lib/libssl.dylib:openssl \
35                    port:curl \
36                    port:libssh2 \
37                    port:rust
38
39    checksums       ${distname}${extract.suffix} \
40rmd160  f003d60b85384433bbdd16acc03fbfc92193d4dd \
41sha256  40bd6c7d634885121abcdbdf1ea9e95177c1b22c6b49ed65543284188fbd701c \
42size    729008
43
44    # use DYLD_FALLBACK_LIBRARY_PATH instead of DYLD_LIBRARY_PATH
45    # without this change, --target and CARGO_BUILD_TARGET fail
46    # see https://users.rust-lang.org/t/subprocess-and-dynamic-library-linking-problem-interaction/7873
47    # see https://github.com/rust-lang/cargo/issues/2888
48    patchfiles-append   path-dyld.diff
49
50    pre-configure {
51        # create Cargo.lock
52        system -W ${worksrcpath} "${cargo.bin} update"
53    }
54
55    post-extract {
56        foreach {cname cversion chksum} ${cargo.crates} {
57            # the libssh2-sys crate requires the header files from
58            #    a version of libssh2 that has not been released
59            #    (e.g. channel.c uses the error code LIBSSH2_ERROR_CHANNEL_WINDOW_FULL)
60            # make sure these header files are found properly
61            if {${cname} eq "libssh2-sys"} {
62                foreach f [glob -tail -directory ${cargo.home}/macports/libssh2-sys-${cversion}/libssh2/include/ *.h] {
63                    ln -s ../include/${f} ${cargo.home}/macports/libssh2-sys-${cversion}/libssh2/src/
64                }
65            }
66        }
67    }
68
69    build.env-append OPENSSL_DIR=${prefix}
70
71    if {${subport} eq ${name}} {
72        depends_build-append \
73            port:${name}-stage1
74
75        cargo.bin ${prefix}/libexec/${name}-stage1/bin/cargo
76
77        destroot {
78            xinstall ${worksrcpath}/target/[cargo.rust_platform]/release/cargo ${destroot}${prefix}/bin
79
80            xinstall -m 0644 \
81                {*}[glob ${worksrcpath}/src/etc/man/*] \
82                ${destroot}${prefix}/share/man/man1
83
84            xinstall -d ${destroot}${prefix}/share/doc/${subport}
85            xinstall -m 0644 \
86                -W ${worksrcpath} \
87                LICENSE-APACHE LICENSE-MIT LICENSE-THIRD-PARTY README.md \
88                ${destroot}${prefix}/share/doc/${subport}
89
90            xinstall -d ${destroot}${prefix}/etc/bash_completion.d
91            xinstall -m 0644 \
92                ${worksrcpath}/src/etc/cargo.bashcomp.sh \
93                ${destroot}${prefix}/etc/bash_completion.d/${subport}
94
95            xinstall -d ${destroot}${prefix}/share/zsh/site-functions
96            xinstall -m 0644 \
97                ${worksrcpath}/src/etc/_cargo \
98                ${destroot}${prefix}/share/zsh/site-functions
99        }
100    } else {
101        # --target and CARGO_BUILD_TARGET do not work correctly
102        # see the patchfile path-dyld.diff
103        universal_variant   no
104
105        depends_build-append \
106            port:${name}-bootstrap
107
108        cargo.bin ${prefix}/libexec/${name}-bootstrap/bin/cargo
109
110        destroot {
111            xinstall -d -m 0755 ${destroot}${prefix}/libexec/${subport}/bin
112            xinstall ${worksrcpath}/target/release/cargo ${destroot}${prefix}/libexec/${subport}/bin
113
114            xinstall -d ${destroot}${prefix}/share/doc/${subport}
115            xinstall -m 0644 \
116                -W ${worksrcpath} \
117                LICENSE-APACHE LICENSE-MIT LICENSE-THIRD-PARTY README.md \
118                ${destroot}${prefix}/share/doc/${subport}
119        }
120    }
121} else {
122    master_sites-append https://static.rust-lang.org/dist/:stage0
123
124    checksums-append \
125        ${name}-${version}-i686-apple-darwin${extract.suffix} \
126rmd160  17458dce93eb7e644385bd82ecb511311765e5e6 \
127sha256  6b7a0a97e0d87cca7b7a5e090d168be6cdbb03298381bece33df493447e17e76 \
128size    3909191
129
130    checksums-append \
131        ${name}-${version}-x86_64-apple-darwin${extract.suffix} \
132rmd160  ac5eff8ae2489845f9761c275b03677a50309c1a \
133sha256  b6f7c662ea75a94f5a5e41c2fee95f09a5ba168429ac8cdd41f6ba2c78d1b07f \
134size    4215369
135
136    if {![variant_isset universal]} {
137        set rust_platform [cargo.rust_platform ${build_arch}]
138        distfiles  ${name}-${version}-${rust_platform}${extract.suffix}:stage0
139        worksrcdir ${name}-${version}-${rust_platform}
140    } else {
141        distfiles
142        foreach arch ${universal_archs} {
143            set rust_platform [cargo.rust_platform ${arch}]
144            distfiles-append  ${name}-${version}-${rust_platform}${extract.suffix}:stage0
145        }
146        post-extract {
147            xinstall -d -m 0755 ${workpath}/${name}-${version}
148            foreach arch ${universal_archs} {
149                set rust_platform [cargo.rust_platform ${arch}]
150                move ${workpath}/${name}-${version}-${rust_platform} ${workpath}/${name}-${version}-${arch}
151            }
152        }
153    }
154
155    build {}
156
157    destroot {
158        xinstall -d -m 0755 ${destroot}${prefix}/libexec/${subport}/bin
159        xinstall -m 0755 ${worksrcpath}/cargo/bin/cargo ${destroot}${prefix}/libexec/${subport}/bin
160
161        xinstall -d -m 0755 ${destroot}${prefix}/share/doc/${subport}
162        xinstall -m 0644 \
163            -W ${worksrcpath} \
164            LICENSE-APACHE LICENSE-MIT LICENSE-THIRD-PARTY README.md \
165            ${destroot}${prefix}/share/doc/${subport}
166    }
167}
168
169subport ${name}-bootstrap {
170    revision        0
171}
172
173subport ${name}-stage1 {}
174
175if {${subport} ne "${name}-bootstrap"} {
176    cargo.crates \
177        aho-corasick 0.6.4 d6531d44de723825aa81398a6415283229725a00fa30713812ab9323faa82fc4 \
178        ansi_term 0.11.0 ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b \
179        atty 0.2.10 2fc4a1aa4c24c0718a250f0681885c1af91419d242f29eb8f2ab28502d80dbd1 \
180        backtrace 0.3.7 8ea58cd16fd6c9d120b5bcb01d63883ae4cc7ba2aed35c1841b862a3c7ef6639 \
181        backtrace-sys 0.1.16 44585761d6161b0f57afc49482ab6bd067e4edef48c12a152c237eb0203f7661 \
182        bitflags 1.0.3 d0c54bb8f454c567f21197eefcdbf5679d0bd99f2ddbe52e84c77061952e6789 \
183        bufstream 0.1.3 f2f382711e76b9de6c744cc00d0497baba02fb00a787f088c879f01d09468e32 \
184        cc 1.0.15 0ebb87d1116151416c0cf66a0e3fb6430cccd120fd6300794b4dfaa050ac40ba \
185        cfg-if 0.1.3 405216fd8fe65f718daa7102ea808a946b6ce40c742998fbfd3463645552de18 \
186        clap 2.31.2 f0f16b89cbb9ee36d87483dc939fe9f1e13c05898d56d7b230a0d4dff033a536 \
187        cmake 0.1.31 95470235c31c726d72bf2e1f421adc1e65b9d561bf5529612cbe1a72da1467b3 \
188        commoncrypto 0.2.0 d056a8586ba25a1e4d61cb090900e495952c7886786fc55f909ab2f819b69007 \
189        commoncrypto-sys 0.2.0 1fed34f46747aa73dfaa578069fd8279d2818ade2b55f38f22a9401c7f4083e2 \
190        core-foundation 0.5.1 286e0b41c3a20da26536c6000a280585d519fd07b3956b43aed8a79e9edce980 \
191        core-foundation-sys 0.5.1 716c271e8613ace48344f723b60b900a93150271e5be206212d052bbc0883efa \
192        crossbeam 0.3.2 24ce9782d4d5c53674646a6a4c1863a21a8fc0cb649b3c94dfc16e45071dea19 \
193        crypto-hash 0.3.1 09de9ee0fc255ace04c7fa0763c9395a945c37c8292bb554f8d48361d1dcf1b4 \
194        curl 0.4.12 aaf20bbe084f285f215eef2165feed70d6b75ba29cad24469badb853a4a287d0 \
195        curl-sys 0.4.5 71c63a540a9ee4e15e56c3ed9b11a2f121239b9f6d7b7fe30f616e048148df9a \
196        dtoa 0.4.2 09c3753c3db574d215cba4ea76018483895d7bff25a31b49ba45db21c48e50ab \
197        env_logger 0.5.10 0e6e40ebb0e66918a37b38c7acab4e10d299e0463fe2af5d29b9cc86710cfd2a \
198        failure 0.1.1 934799b6c1de475a012a02dab0ace1ace43789ee4b99bcfbf1a2e3e8ced5de82 \
199        failure_derive 0.1.1 c7cdda555bb90c9bb67a3b670a0f42de8e73f5981524123ad8578aafec8ddb8b \
200        filetime 0.1.15 714653f3e34871534de23771ac7b26e999651a0a228f47beb324dfdf1dd4b10f \
201        filetime 0.2.1 da4b9849e77b13195302c174324b5ba73eec9b236b24c221a61000daefb95c5f \
202        flate2 1.0.1 9fac2277e84e5e858483756647a9d0aa8d9a2b7cba517fd84325a0aaa69a0909 \
203        fnv 1.0.6 2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3 \
204        foreign-types 0.3.2 f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1 \
205        foreign-types-shared 0.1.1 00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b \
206        fs2 0.4.3 9564fc758e15025b46aa6643b1b77d047d1a56a1aea6e01002ac0c7026876213 \
207        fuchsia-zircon 0.3.3 2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82 \
208        fuchsia-zircon-sys 0.3.3 3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7 \
209        git2 0.7.1 0f41c0035c37ec11ed3f1e1946a76070b0c740393687e9a9c7612f6a709036b3 \
210        git2-curl 0.8.1 b502f6b1b467957403d168f0039e0c46fa6a1220efa2adaef25d5b267b5fe024 \
211        glob 0.2.11 8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb \
212        globset 0.4.0 142754da2c9b3722affd909f9e27f2a6700a7a303f362971e0a74c652005a43d \
213        hex 0.3.2 805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77 \
214        home 0.3.3 80dff82fb58cfbbc617fb9a9184b010be0529201553cda50ad04372bc2333aff \
215        humantime 1.1.1 0484fda3e7007f2a4a0d9c3a703ca38c71c54c55602ce4660c419fd32e188c9e \
216        idna 0.1.4 014b298351066f1512874135335d62a789ffe78a9974f94b43ed5621951eaf7d \
217        ignore 0.4.2 787a5940ab88e0f2f3b2cad3687060bddcf67520f3b761abc31065c9c495d088 \
218        itoa 0.4.1 c069bbec61e1ca5a596166e55dfe4773ff745c3d16b700013bcaff9a6df2c682 \
219        jobserver 0.1.11 60af5f849e1981434e4a31d3d782c4774ae9b434ce55b101a96ecfd09147e8be \
220        kernel32-sys 0.2.2 7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d \
221        lazy_static 1.0.0 c8f31047daa365f19be14b47c29df4f7c3b581832407daabe6ae77397619237d \
222        lazycell 0.6.0 a6f08839bc70ef4a3fe1d566d5350f519c5912ea86be0df1740a7d247c7fc0ef \
223        libc 0.2.40 6fd41f331ac7c5b8ac259b8bf82c75c0fb2e469bbf37d2becbba9a6a2221965b \
224        libgit2-sys 0.7.1 1ecbd6428006c321c29b6c8a895f0d90152f1cf4fd8faab69fc436a3d9594f63 \
225        libssh2-sys 0.2.7 5afcb36f9a2012ab8d3a9ba5186ee2d1c4587acf199cb47879a73c5fe1b731a4 \
226        libz-sys 1.0.18 87f737ad6cc6fd6eefe3d9dc5412f1573865bded441300904d2f42269e140f16 \
227        log 0.4.1 89f010e843f2b1a31dbd316b3b8d443758bc634bed37aabade59c686d644e0a2 \
228        matches 0.1.6 100aabe6b8ff4e4a7e32c1c13523379802df0772b82466207ac25b013f193376 \
229        memchr 2.0.1 796fba70e76612589ed2ce7f45282f5af869e0fdd7cc6199fa1aa1f1d591ba9d \
230        miniz-sys 0.1.10 609ce024854aeb19a0ef7567d348aaa5a746b32fb72e336df7fcc16869d7e2b4 \
231        miow 0.3.1 9224c91f82b3c47cf53dcf78dfaa20d6888fbcc5d272d5f2fcdf8a697f3c987d \
232        num-traits 0.2.4 775393e285254d2f5004596d69bb8bc1149754570dcc08cf30cabeba67955e28 \
233        num_cpus 1.8.0 c51a3322e4bca9d212ad9a158a02abc6934d005490c054a2778df73a70aa0a30 \
234        openssl 0.10.7 63c6ff2c7d9903daf9f3429eb2f6beedb15b1f7362e3529e5bf00b6caf182400 \
235        openssl-probe 0.1.2 77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de \
236        openssl-sys 0.9.30 73ae718c3562989cd3a0a5c26610feca02f8116822f6f195e6cf4887481e57f5 \
237        percent-encoding 1.0.1 31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831 \
238        pkg-config 0.3.11 110d5ee3593dbb73f56294327fe5668bcc997897097cbc76b51e7aed3f52452f \
239        proc-macro2 0.3.8 1b06e2f335f48d24442b35a19df506a835fb3547bc3c06ef27340da9acf5cae7 \
240        quick-error 1.2.1 eda5fe9b71976e62bc81b781206aaa076401769b2143379d3eb2118388babac4 \
241        quote 0.5.2 9949cfe66888ffe1d53e6ec9d9f3b70714083854be20fd5e271b232a017401e8 \
242        quote 0.3.15 7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a \
243        rand 0.4.2 eba5f8cb59cc50ed56be8880a5c7b496bfd9bd26394e176bc67884094145c2c5 \
244        redox_syscall 0.1.37 0d92eecebad22b767915e4d529f89f28ee96dbbf5a4810d2b844373f136417fd \
245        redox_termios 0.1.1 7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76 \
246        regex 1.0.0 75ecf88252dce580404a22444fc7d626c01815debba56a7f4f536772a5ff19d3 \
247        regex 0.2.11 9329abc99e39129fcceabd24cf5d85b4671ef7c29c50e972bc5afe32438ec384 \
248        regex-syntax 0.6.0 8f1ac0f60d675cc6cf13a20ec076568254472551051ad5dd050364d70671bf6b \
249        regex-syntax 0.5.6 7d707a4fa2637f2dca2ef9fd02225ec7661fe01a53623c1e6515b6916511f7a7 \
250        remove_dir_all 0.5.1 3488ba1b9a2084d38645c4c08276a1752dcbf2c7130d74f1569681ad5d2799c5 \
251        rustc-demangle 0.1.8 76d7ba1feafada44f2d38eed812bd2489a03c0f5abb975799251518b68848649 \
252        same-file 1.0.2 cfb6eded0b06a0b512c8ddbcf04089138c9b4362c2f696f3c3d76039d68f3637 \
253        schannel 0.1.12 85fd9df495640643ad2d00443b3d78aae69802ad488debab4f1dd52fc1806ade \
254        scopeguard 0.3.3 94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27 \
255        semver 0.9.0 1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403 \
256        semver-parser 0.7.0 388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3 \
257        serde 1.0.55 97f6a6c3caba0cf8f883b53331791036404ce3c1bd895961cf8bb2f8cecfd84b \
258        serde_derive 1.0.55 f51b0ef935cf8a41a77bce553da1f8751a739b7ad82dd73669475a22e6ecedb0 \
259        serde_ignored 0.0.4 190e9765dcedb56be63b6e0993a006c7e3b071a016a304736e4a315dc01fb142 \
260        serde_json 1.0.17 f3ad6d546e765177cf3dded3c2e424a8040f870083a0e64064746b958ece9cb1 \
261        shell-escape 0.1.4 170a13e64f2a51b77a45702ba77287f5c6829375b04a69cf2222acd17d0cfab9 \
262        socket2 0.3.5 ff606e0486e88f5fc6cfeb3966e434fb409abbc7a3ab495238f70a1ca97f789d \
263        strsim 0.7.0 bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550 \
264        syn 0.13.10 77961dcdac942fa8bc033c16f3a790b311c8a27d00811b878ebd8cf9b7ba39d5 \
265        syn 0.11.11 d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad \
266        synom 0.11.3 a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6 \
267        synstructure 0.6.1 3a761d12e6d8dcb4dcf952a7a89b475e3a9d69e4a69307e01a470977642914bd \
268        tar 0.4.15 6af6b94659f9a571bf769a5b71f54079393585ee0bfdd71b691be22d7d6b1d18 \
269        tempfile 3.0.2 47776f63b85777d984a50ce49d6b9e58826b6a3766a449fc95bc66cd5663c15b \
270        termcolor 0.3.6 adc4587ead41bf016f11af03e55a624c06568b5a19db4e90fde573d805074f83 \
271        termion 1.5.1 689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096 \
272        textwrap 0.9.0 c0b59b6b4b44d867f1370ef1bd91bfb262bf07bf0ae65c202ea2fbc16153b693 \
273        thread_local 0.3.5 279ef31c19ededf577bfd12dfae728040a21f635b06a24cd670ff510edd38963 \
274        toml 0.4.6 a0263c6c02c4db6c8f7681f9fd35e90de799ebd4cfdeab77a38f4ff6b3d8c0d9 \
275        ucd-util 0.1.1 fd2be2d6639d0f8fe6cdda291ad456e23629558d466e2789d2c3e9892bda285d \
276        unicode-bidi 0.3.4 49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5 \
277        unicode-normalization 0.1.7 6a0180bc61fc5a987082bfa111f4cc95c4caff7f9799f3e46df09163a937aa25 \
278        unicode-width 0.1.4 bf3a113775714a22dcb774d8ea3655c53a32debae63a063acc00a91cc586245f \
279        unicode-xid 0.1.0 fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc \
280        unicode-xid 0.0.4 8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc \
281        unreachable 1.0.0 382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56 \
282        url 1.7.0 f808aadd8cfec6ef90e4a14eb46f24511824d1ac596b9682703c87056c8678b7 \
283        utf8-ranges 1.0.0 662fab6525a98beff2921d7f61a39e7d59e0b425ebc7d0d9e66d316e55124122 \
284        vcpkg 0.2.3 7ed0f6789c8a85ca41bbc1c9d175422116a9869bd1cf31bb08e1493ecce60380 \
285        vec_map 0.8.1 05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a \
286        void 1.0.2 6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d \
287        walkdir 2.1.4 63636bd0eb3d00ccb8b9036381b526efac53caf112b7783b730ab3f8e44da369 \
288        winapi 0.3.4 04e3bd221fcbe8a271359c04f21a76db7d0c6028862d1bb5512d85e1e2eb5bb3 \
289        winapi 0.2.8 167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a \
290        winapi-build 0.1.1 2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc \
291        winapi-i686-pc-windows-gnu 0.4.0 ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6 \
292        winapi-x86_64-pc-windows-gnu 0.4.0 712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f \
293        wincolor 0.1.6 eeb06499a3a4d44302791052df005d5232b927ed1a9658146d842165c4de7767
294}