summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: b17b44324a1007f0f1ef7c23e8faf0c9e711b2c6 (plain)
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
# Maintainer: spider-mario <spidermario@free.fr>
# Contributor: Taras Shpot <mrshpot@gmail.com>
# Contributor: Tatsuyuki Ishi <ishitatsuyuki@gmail.com>
pkgname=('rust-git' 'rust-docs-git' 'rust-src-git')
pkgver=1.0.0.beta.2833.gb850046
epoch=3
pkgrel=3
pkgdesc="Systems programming language focused on safety, speed and concurrency"
arch=('i686' 'x86_64')
url="http://www.rust-lang.org/"
license=('MIT' 'Apache')
makedepends=('git' 'libffi' 'python2' 'curl' 'llvm' 'jemalloc')
source=("git+https://github.com/rust-lang/rust.git"
        "git+https://github.com/rust-lang/compiler-rt.git"
        "git+https://github.com/rust-lang/jemalloc.git"
        "git+https://github.com/rust-lang/libc.git"
        "git+https://github.com/rust-lang/llvm.git"
        "git+https://github.com/rust-lang/hoedown.git"
        "git+https://github.com/rust-lang/rust-installer.git"

        "git+https://github.com/rust-lang/rust.vim.git"
        "git+https://github.com/rust-lang/rust-mode.git"
        "git+https://github.com/rust-lang/zsh-config.git")
_noclone=(compiler-rt jemalloc libc llvm hoedown rust-installer)
sha512sums=('SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP')

pkgver() {
	cd rust
	echo "$(grep -m1 '^CFG_RELEASE_NUM=' mk/main.mk | cut -d'=' -f2)"."$(git rev-parse --short HEAD)"
}

prepare() {
	rm -rf -- "${_noclone[@]}"

	cd rust
	_srcdest="$SRCDEST" perl -pi -- /dev/stdin .gitmodules <<'END'
		if (m{(?<assignment> \s* url \s* = \s*) .* / (?<submodule> [^/]*?)(?:\.git)?$}x) {
			my $local = "$ENV{_srcdest}/$+{submodule}";
			$_ = "$+{assignment}$local\n" if -d $local;
		}
END
}

build() {
	cd rust

	./configure \
		--prefix=/usr \
		--disable-rustbuild \
		--llvm-root=/usr \
		--enable-llvm-link-shared \
		--jemalloc-root=/usr/lib/

	make
}

package_rust-git() {
	depends=('shared-mime-info' 'llvm-libs')
	optdepends=('rust-doc-git: language and API documentation')
	provides=('rust')
	conflicts=('rust')
	options=('staticlibs')
	install=rust.install

	cd rust

	make DESTDIR="$pkgdir" install

	rm -f "$pkgdir"/usr/lib/rustlib/{manifest-rust-docs,install.log,uninstall.sh}

	install --directory "$pkgdir"/usr/share/licenses/$pkgname/
	install -m644 COPYRIGHT LICENSE-* "$pkgdir"/usr/share/licenses/$pkgname/

	install --directory "$pkgdir"/usr/share/vim/vimfiles/
	cp -a "$srcdir"/rust.vim/*/ "$pkgdir"/usr/share/vim/vimfiles/

	install --directory "$pkgdir"/usr/share/zsh/functions/Completion/Zsh/
	cp -a "$srcdir"/zsh-config/_* "$pkgdir"/usr/share/zsh/functions/Completion/Zsh/

	cd "$srcdir"/rust-mode
	emacs --eval '(byte-recompile-directory "." 0)' --quick --batch 2> /dev/null || true
	install --directory "$pkgdir"/usr/share/emacs/site-lisp/
	cp -a rust-mode.* "$pkgdir"/usr/share/emacs/site-lisp/

	rm -fr "$pkgdir"/usr/share/doc
}

package_rust-docs-git() {
	pkgdesc="Systems programming language focused on safety, speed and concurrency (Language and API documentation)"
	arch=('any')
	options+=('!strip' '!emptydirs')
	optdepends=('rust-git: to compile and run the programs you can write using this documentation')
	provides=('rust-doc' 'rust-docs')
	conflicts=('rust-doc' 'rust-docs')
	replaces=('rust-doc-git')

	cd rust

	install --directory "$pkgdir"/usr/share/doc
	cp -r doc "$pkgdir"/usr/share/doc/rust

	install --directory "$pkgdir"/usr/share/licenses/$pkgname/
	install -m644 COPYRIGHT LICENSE-* "$pkgdir"/usr/share/licenses/$pkgname/
}

package_rust-src-git() {
	pkgdesc="Systems programming language focused on safety, speed and concurrency (Source Code)"
	arch=('any')
	provides=('rust-src')
	conflicts=('rust-src')

	cd rust
	git checkout-index -a --prefix "$pkgdir"/usr/src/rust/
}