summarylogtreecommitdiffstats
path: root/PKGBUILD
diff options
context:
space:
mode:
authorpingplug2018-02-14 00:04:39 +0800
committerpingplug2018-02-14 00:04:39 +0800
commite75af02ff617fc8e68b46eeea8052bcb71b9710f (patch)
treed25cf415978b60f0534bdc031323a3c7d71701d7 /PKGBUILD
downloadaur-e75af02ff617fc8e68b46eeea8052bcb71b9710f.tar.gz
Initial commit
DO NOT USE THIS!
Diffstat (limited to 'PKGBUILD')
-rw-r--r--PKGBUILD119
1 files changed, 119 insertions, 0 deletions
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..f0988e3ef2fb
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,119 @@
+# Maintainer: pingplug <pingplug@foxmail.com>
+
+pkgname=mingw-w64-rust-bin
+_pkgname=rust
+pkgver=1.23.0
+pkgrel=1
+pkgdesc="rust language prebuilt toolchain with mingw target (mingw-w64)"
+arch=('any')
+url='https://www.rust-lang.org/'
+license=('MIT' 'Apache' 'custom')
+depends=('gcc-libs' 'curl' 'mingw-w64-crt<5.0.3.20180112' 'mingw-w64-gcc')
+optdepends=('wine: for cargo test support')
+options=(!emptydirs staticlibs !strip)
+provides=('mingw-w64-rust')
+conflicts=('mingw-w64-rust')
+replaces=('mingw-w64-rust')
+makedepends=()
+
+source=("https://static.rust-lang.org/dist/rust-${pkgver}-x86_64-unknown-linux-gnu.tar.gz"{,.asc}
+ "https://static.rust-lang.org/dist/rust-std-${pkgver}-i686-pc-windows-gnu.tar.xz"{,.asc}
+ "https://static.rust-lang.org/dist/rust-std-${pkgver}-x86_64-pc-windows-gnu.tar.xz"{,.asc})
+sha256sums=('9a34b23a82d7f3c91637e10ceefb424539dcfa327c2dcd292ff10c047b1fdc7e'
+ 'SKIP'
+ '03b1fce4642061b7e05cf689a2640ce9e0648d19185c753789b7df6525920495'
+ 'SKIP'
+ '7101ce1320a6dcc0c1e1fdd20bbf8d7a8e381bdb128f4e38713147a9566be62d'
+ 'SKIP')
+validpgpkeys=('108F66205EAEB0AAA8DD5E1C85AB96E6FA1BE5FE') # Rust Language (Tag and Release Signing Key) <rust-key@rust-lang.org>
+
+backup=("opt/${_pkgname}/cargo/config")
+
+prepare() {
+ cd ${srcdir}
+ rm -rf "rust-${pkgver}-x86_64-unknown-linux-gnu/rust-std-i686-pc-windows-gnu"
+ mv "rust-std-${pkgver}-i686-pc-windows-gnu/rust-std-i686-pc-windows-gnu" "rust-${pkgver}-x86_64-unknown-linux-gnu"
+ cat "rust-std-${pkgver}-i686-pc-windows-gnu/components" >> "rust-${pkgver}-x86_64-unknown-linux-gnu/components"
+
+ rm -rf "rust-${pkgver}-x86_64-unknown-linux-gnu/rust-std-x86_64-pc-windows-gnu"
+ mv "rust-std-${pkgver}-x86_64-pc-windows-gnu/rust-std-x86_64-pc-windows-gnu" "rust-${pkgver}-x86_64-unknown-linux-gnu"
+ cat "rust-std-${pkgver}-x86_64-pc-windows-gnu/components" >> "rust-${pkgver}-x86_64-unknown-linux-gnu/components"
+}
+
+package() {
+ cd "${srcdir}/rust-${pkgver}-x86_64-unknown-linux-gnu"
+ # rustc, cargo, and libs.
+ ./install.sh \
+ --disable-ldconfig \
+ --destdir="${pkgdir}" \
+ --components=rustc,cargo,rust-std-x86_64-unknown-linux-gnu,rust-std-i686-pc-windows-gnu,rust-std-x86_64-pc-windows-gnu \
+ --prefix=/opt/${_pkgname}
+
+ # license
+ install -dm755 "${pkgdir}/usr/share/licenses/${pkgname}/"{rust,cargo}
+ mv "${pkgdir}/opt/${_pkgname}/share/doc/cargo/"LICENSE-* "${pkgdir}/usr/share/licenses/${pkgname}/cargo/"
+ mv "${pkgdir}/opt/${_pkgname}/share/doc/rust/"{LICENSE-*,COPYRIGHT} "${pkgdir}/usr/share/licenses/${pkgname}/rust/"
+
+ # remove unused files
+ rm -r "${pkgdir}/opt/${_pkgname}/"{etc,share}
+ rm "${pkgdir}/opt/${_pkgname}/lib/rustlib/"{manifest-*,install.log,uninstall.sh,components,rust-installer-version}
+
+ # link shared libraries
+ pushd "${pkgdir}/opt/${_pkgname}/lib"
+ ln -sf "rustlib/x86_64-unknown-linux-gnu/lib/"*.so .
+ popd
+ pushd "${pkgdir}"
+ install -dm755 "${pkgdir}/usr/i686-w64-mingw32/bin"
+ ln -sf "opt/${_pkgname}/lib/rustlib/i686-pc-windows-gnu/lib/"*.dll "usr/i686-w64-mingw32/bin"
+ install -dm755 "${pkgdir}/usr/x86_64-w64-mingw32/bin"
+ ln -sf "opt/${_pkgname}/lib/rustlib/x86_64-pc-windows-gnu/lib/"*.dll "usr/x86_64-w64-mingw32/bin"
+ popd
+
+ # strip
+ strip --strip-all "${pkgdir}/opt/${_pkgname}/bin/"{cargo,rustc,rustdoc}
+ strip --strip-unneeded "${pkgdir}/opt/${_pkgname}/lib/rustlib/x86_64-unknown-linux-gnu/lib/"*.so
+ i686-w64-mingw32-strip --strip-unneeded "${pkgdir}/opt/${_pkgname}/lib/rustlib/i686-pc-windows-gnu/lib/"*.dll
+ x86_64-w64-mingw32-strip --strip-unneeded "${pkgdir}/opt/${_pkgname}/lib/rustlib/x86_64-pc-windows-gnu/lib/"*.dll
+
+ # config
+ install -dm777 "${pkgdir}/opt/${_pkgname}/cargo"
+ cat << EOF >> "${pkgdir}/opt/${_pkgname}/cargo/config"
+[target.i686-pc-windows-gnu]
+linker = "/usr/bin/i686-w64-mingw32-gcc"
+ar = "/usr/i686-w64-mingw32/bin/ar"
+EOF
+ if pacman -T "wine" ; then
+ cat << EOF >> "${pkgdir}/opt/${_pkgname}/cargo/config"
+runner = "wine"
+EOF
+ fi
+ if [[ ! -f "/usr/i686-w64-mingw32/bin/libgcc_s_dw2-1.dll" ]] ; then
+ cat << EOF >> "${pkgdir}/opt/${_pkgname}/cargo/config"
+rustflags = ["-C", "panic=abort"]
+EOF
+ fi
+
+ cat << EOF >> "${pkgdir}/opt/${_pkgname}/cargo/config"
+
+[target.x86_64-pc-windows-gnu]
+linker = "/usr/bin/x86_64-w64-mingw32-gcc"
+ar = "/usr/x86_64-w64-mingw32/bin/ar"
+EOF
+ if pacman -T "wine" ; then
+ cat << EOF >> "${pkgdir}/opt/${_pkgname}/cargo/config"
+runner = "wine"
+EOF
+ fi
+ if [[ ! -f "/usr/x86_64-w64-mingw32/bin/libgcc_s_seh-1.dll" ]] ; then
+ cat << EOF >> "${pkgdir}/opt/${_pkgname}/cargo/config"
+rustflags = ["-C", "panic=abort"]
+EOF
+ fi
+ if pacman -T "mingw-w64-crt>3.0.5.20171219" ; then
+ cat << EOF >> "${pkgdir}/opt/${_pkgname}/cargo/config"
+rustflags = ["-C", "link-arg=-lmsvcrt"]
+EOF
+ fi
+}
+
+# vim:set ts=2 sw=2 et: