summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 39243d0b2ae25666894fac8fc2b44ba14ddfda51 (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
# Maintainer: wallabra <gr.wallabra@proton.me>
pkgbase="xcc-git"
pkgname=("xcc-git" "xcc-wcc-git" "xcc-common-git")
pkgver=0.1.6.r5.13987d67
pkgrel=1
arch=(x86_64)
url="https://github.com/tyfkda/xcc"
license=('MIT')
groups=()
depends=()
makedepends=('git' 'npm' 'llvm')
replaces=()
backup=()
options=()
install=
source=('xcc::git+https://github.com/tyfkda/xcc' 'xcc-wrapper.sh' 'wcc-wrapper.sh')
noextract=()
sha256sums=('SKIP'
            'daaddbbe0fde9dcf65ad78616ba0ee484c9fb909bb764500595f72d8a0402b48'
            'b3f9ae61914b6e60e0a1a377f0cce721f5a69ee291354b2dffce958c612e987c')

pkgver() {
	cd "$srcdir/xcc"

	printf "%s" "$(git describe --long --tags | sed 's/\([^-]*-\)g/r\1/;s/-/./g')"
}

build() {
	cd "$srcdir/xcc"

	# Make xcc
	make

	# Make wcc
	npm ci
	make wcc
}

check() {
	cd "$srcdir/xcc"
	make -k test
}

package_xcc-common-git() {
	pkgdesc="Libraries and headers used by xcc, a very tiny, very fast C compiler, assembler, linker, and libc suite, which can target x86-64, aarch64, riscv64, and WASM."
	provides=("xcc-common")
	conflicts=("xcc-common")
	
	cd "$srcdir/xcc"

    install -d "$pkgdir/usr/lib/xcc/bin/lib"
    install -m644 lib/*.a "$pkgdir/usr/lib/xcc/bin/lib" # PLEASE FORGIVE ME!

    install -d "$pkgdir/usr/lib/xcc/bin/include"
    cp -a include/. "$pkgdir/usr/lib/xcc/bin/include/" # Again, I beg for your forgiveness

    install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

package_xcc-git() {
	pkgdesc="A very tiny, very fast C compiler, assembler, linker, and libc, which can target x86-64, aarch64, riscv64."
	provides=("xcc")
	conflicts=("xcc")
	depends=("xcc-common" "glibc"
		"sh") # due to wrapper script

	cd "$srcdir/xcc"

    install -d "$pkgdir/usr/lib/xcc/bin"
	install -m755 cc1 "$pkgdir/usr/lib/xcc/bin/cc1"
    install -m755 cpp "$pkgdir/usr/lib/xcc/bin/cpp"
    install -m755 as  "$pkgdir/usr/lib/xcc/bin/as"
    install -m755 ld  "$pkgdir/usr/lib/xcc/bin/ld"
	install -m755 xcc "$pkgdir/usr/lib/xcc/bin/xcc"
	
    install -d "$pkgdir/usr/bin"
	install -Dm755 "$srcdir/xcc-wrapper.sh" "$pkgdir/usr/bin/xcc"

    install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

package_xcc-wcc-git(){
	pkgdesc="A very tiny, very fast C compiler, assembler, linker, and libc, which can directly output wasm files."
	provides=("wcc")
	conflicts=("wcc")
	depends=("xcc-common" "glibc"
		"sh") # due to wrapper script

	cd "$srcdir/xcc"

    install -d "$pkgdir/usr/lib/xcc/bin"
	install -m755 wcc "$pkgdir/usr/lib/xcc/bin/wcc"

	install -d "$pkgdir/usr/bin"
	install -Dm755 "$srcdir/wcc-wrapper.sh" "$pkgdir/usr/bin/wcc"

    install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}