1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
|
# Maintainer: pingplug < aur at pingplug dot me >
# Contributor: Johannes Löthberg < johannes at kyriasis dot com >
# Contributor: Alexander F Rødseth < xyproto at archlinux dot org >
# Contributor: Daniel Micay < danielmicay at gmail dot com >
# Contributor: userwithuid < userwithuid at gmail dot com >
_pkgname=rust
_date=2023-07-13
_rustc=1.71.0
pkgname=mingw-w64-rust
_prefix=opt/rust
pkgver=1.72.0
pkgrel=1
pkgdesc="Systems programming language focused on safety, speed and concurrency (mingw-w64)"
arch=('x86_64')
url="https://www.rust-lang.org"
license=('MIT' 'Apache' 'custom')
depends=('gcc-libs'
'curl'
'libgit2'
'mingw-w64-gcc>=10.1.0')
optdepends=('mingw-w64-wine: for cargo test support')
makedepends=('gdb'
'ninja'
'libffi'
'perl'
'python'
'nodejs'
'procps-ng'
'cmake')
options=('!strip' 'staticlibs' '!buildflags')
source=("https://static.rust-lang.org/dist/rustc-${pkgver}-src.tar.xz"{,.asc}
"https://static.rust-lang.org/dist/${_date}/rust-std-${_rustc}-x86_64-unknown-linux-gnu.tar.xz"{,.asc}
"https://static.rust-lang.org/dist/${_date}/rustc-${_rustc}-x86_64-unknown-linux-gnu.tar.xz"{,.asc}
"https://static.rust-lang.org/dist/${_date}/cargo-${_rustc}-x86_64-unknown-linux-gnu.tar.xz"{,.asc}
"mingw-config.toml")
noextract=("rust-std-${_rustc}-x86_64-unknown-linux-gnu.tar.xz"
"rustc-${_rustc}-x86_64-unknown-linux-gnu.tar.xz"
"cargo-${_rustc}-x86_64-unknown-linux-gnu.tar.xz")
sha256sums=('d307441f8ee78a7e94f72cb5c81383822f13027f79e67a5551bfd2c2d2db3014'
'SKIP'
'98ae6530c3a41167e9d93d11ea078be98a02f6d809a06d0d51af3ce0f73150d7'
'SKIP'
'c293d906769671d1cd18e945671bbd14e0b8a41df5075c47f33e6086fc8a1558'
'SKIP'
'fe6fb520f59966300ee661d18b37c36cb3e614877c4c01dfedf987b8a9c577e9'
'SKIP'
'2661456d13366cd181de9e7ddfa797c7ef6be9fe9f3d0d766089870e45b8010c')
validpgpkeys=('108F66205EAEB0AAA8DD5E1C85AB96E6FA1BE5FE') # Rust Language (Tag and Release Signing Key) <rust-key@rust-lang.org>
backup=("opt/rust/cargo/config")
prepare() {
cd "rustc-${pkgver}-src"
cp "${srcdir}"/mingw-config.toml config.toml
sed -i "s|\@PREFIX\@|/${_prefix}|" config.toml
cd "${srcdir}"
mkdir -p "${srcdir}/rustc-${pkgver}-src/build/cache/${_date}"
cp rust-std-${_rustc}-x86_64-unknown-linux-gnu.tar.xz "rustc-${pkgver}-src/build/cache/${_date}"
cp rustc-${_rustc}-x86_64-unknown-linux-gnu.tar.xz "rustc-${pkgver}-src/build/cache/${_date}"
cp cargo-${_rustc}-x86_64-unknown-linux-gnu.tar.xz "rustc-${pkgver}-src/build/cache/${_date}"
}
build() {
cd "rustc-${pkgver}-src"
export CFLAGS="-O2 -pipe -fno-plt -Wall -D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4"
export CXXFLAGS="-O2 -pipe -fno-plt -Wall -D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4"
# TODO: find a way to disable packaging
DESTDIR="${srcdir}/rust_install" python ./x.py install
}
package() {
cd "rustc-${pkgver}-src"
mv "${srcdir}/rust_install/"* "${pkgdir}"
# license
install -dm755 "${pkgdir}/usr/share/licenses/${pkgname}/"{rust,cargo}
mv "${pkgdir}"/${_prefix}/share/doc/rust/LICENSE-*.old "${pkgdir}/usr/share/licenses/${pkgname}/cargo/"
rename '.old' '' "${pkgdir}/usr/share/licenses/${pkgname}/cargo/"*
mv "${pkgdir}"/${_prefix}/share/doc/rust/{LICENSE-*,COPYRIGHT} "${pkgdir}/usr/share/licenses/${pkgname}/rust/"
# remove unused files
rm -r "${pkgdir}/etc"
rm -r "${pkgdir}/${_prefix}/share"
rm "${pkgdir}/${_prefix}/lib/rustlib/"{manifest-*,install.log,uninstall.sh,components,rust-installer-version}
# link shared libraries
pushd "${pkgdir}/${_prefix}/lib"
ln -sf "rustlib/x86_64-unknown-linux-gnu/lib/"*.so .
popd
install -dm755 "${pkgdir}/usr/i686-w64-mingw32/bin" && pushd "${pkgdir}/usr/i686-w64-mingw32/bin"
ln -sf "../../../${_prefix}/lib/rustlib/i686-pc-windows-gnu/lib/"*.dll .
popd
install -dm755 "${pkgdir}/usr/x86_64-w64-mingw32/bin" && pushd "${pkgdir}/usr/x86_64-w64-mingw32/bin"
ln -sf "../../../${_prefix}/lib/rustlib/x86_64-pc-windows-gnu/lib/"*.dll .
popd
# strip
strip --strip-all "${pkgdir}/${_prefix}/bin/"{cargo,rustc,rustdoc}
strip --strip-all "${pkgdir}/${_prefix}/lib/rustlib/x86_64-unknown-linux-gnu/bin/"rust-*
strip --strip-all "${pkgdir}/${_prefix}/lib/rustlib/x86_64-unknown-linux-gnu/bin/gcc-ld/"*
strip --strip-all "${pkgdir}/${_prefix}/libexec/"*
strip --strip-unneeded "${pkgdir}/${_prefix}/lib/librustc"*.so
strip --strip-unneeded "${pkgdir}/${_prefix}/lib/rustlib/x86_64-unknown-linux-gnu/lib/"*.so
i686-w64-mingw32-strip --strip-unneeded "${pkgdir}/${_prefix}/lib/rustlib/i686-pc-windows-gnu/lib/"*.dll
x86_64-w64-mingw32-strip --strip-unneeded "${pkgdir}/${_prefix}/lib/rustlib/x86_64-pc-windows-gnu/lib/"*.dll
# config
install -dm777 "${pkgdir}/opt/rust/cargo"
cat << EOF >> "${pkgdir}/opt/rust/cargo/config"
[net]
git-fetch-with-cli = true
[target.i686-pc-windows-gnu]
linker = "/usr/bin/i686-w64-mingw32-gcc"
ar = "/usr/i686-w64-mingw32/bin/ar"
EOF
if pacman -T "mingw-w64-wine" ; then
cat << EOF >> "${pkgdir}/opt/rust/cargo/config"
runner = "/usr/bin/i686-w64-mingw32-wine"
EOF
fi
cat << EOF >> "${pkgdir}/opt/rust/cargo/config"
rustflags = [
]
EOF
cat << EOF >> "${pkgdir}/opt/rust/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 "mingw-w64-wine" ; then
cat << EOF >> "${pkgdir}/opt/rust/cargo/config"
runner = "/usr/bin/x86_64-w64-mingw32-wine"
EOF
fi
cat << EOF >> "${pkgdir}/opt/rust/cargo/config"
rustflags = [
]
EOF
}
# vim:set ts=2 sw=2 et:
|