summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: c29c0a81f34304d69864ddb775f7b8afbae1731d (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
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
pkgbase="wuffs"

pkgname=(
	"wuffs-lib"
	#"wuffs-examples"
	"wuffs-fuzzers"
	"wuffs-lang"
	"wuffs-docs"
	"wuffs-license"
)

pkgdesc="A memory-safe programming language, and a standard library, for Wrangling Untrusted File Formats Safely. Wrangling includes parsing, decoding and encoding. Example file formats include images, audio, video, fonts and compressed archives."

pkgver=0.3.6
pkgrel=1

arch=(
	'x86_64'
)
url="https://github.com/google/wuffs"
license=(
	"MIT"
	"Apache-2.0"
)
makedepends=(
	'gcc'
	'gcc-libs'
	'glibc'
	'git'
	'go'
	"libxcb"
	"lz4"
	"sdl2"
	"sdl2_image"
	"xcb-util-image"
	"xcb-util-renderutil"
	"zlib"
	"zstd"
	"clang"
)

checkdepends=()

source=(
	"source::git+${url}.git#tag=v${pkgver}"
)
sha256sums=('575956ed312cd4e68e8f228f59be6e3ee340ff7ee0881a023e431e8643205c89')

build() {
	cd source
	export GOPATH="${srcdir}/go"
	export GOBIN="${GOPATH}/bin"
	export PATH="/usr/bin:${GOPATH}/bin"
	sed -i 's|go test|#go test|g' ./build-all.sh
	sed -i 's|wuffs bench|#wuffs bench|g' ./build-all.sh
	#./build-all.sh

	CC=${CC:-gcc}
	CXX=${CXX:-g++}
	go install github.com/google/wuffs/cmd/...
	wuffs gen
	WARNING_FLAGS="-Wall -Werror -Wpedantic -Wcast-qual -Wcast-align -Wpointer-arith -Wfloat-equal -Wundef -Wvla -Wconversion -Wshadow -Wredundant-decls -Wunused-const-variable"
	C_WARNING_FLAGS="$WARNING_FLAGS -Wstrict-prototypes -Wold-style-definition"
	CXX_WARNING_FLAGS="$WARNING_FLAGS"
	wuffs genlib -skipgen
	wuffs test   -skipgen -mimic
	./build-fuzz.sh
}

package_wuffs-lib() {
	cd source
	pkgdesc='A memory-safe standard library for Wrangling Untrusted File Formats Safely. Wrangling includes parsing, decoding and encoding. Example file formats include images, audio, video, fonts and compressed archives.'
	depends=(
		"glibc"
		"wuffs-license"
	)
	provides=(
		"libwuffs.so"
		"libwuffs.a"
	)
	optdepends=(
		"python-pywuffs: Python bindings"
		"wuffs-docs: Docs"
	)
	install -vDm644 \
		-t "${pkgdir}/usr/include" \
		release/c/*.c gen/c/*.c
	install -vDm644 \
		-t "${pkgdir}/usr/include/wuffs" \
		release/c/*.c gen/c/*.c
	install -vDm755 \
		-t "${pkgdir}/usr/lib" \
		gen/lib/c/gcc-dynamic/libwuffs.so
	install -vDm644 -t \
		"${pkgdir}/usr/lib" \
		gen/lib/c/gcc-static/libwuffs.a
	install -vDm644 -t \
		"${pkgdir}/usr/share/doc/wuffs-lib" \
		release/c/README.md
	install -vdm644 "${pkgdir}/usr/share/licenses"
	ln -srf \
		"${pkgdir}/usr/share/licenses/wuffs" \
		"${pkgdir}/usr/share/licenses"/wuffs-lib
}

package_wuffs-examples() {
	pkgdesc='Example programmes for wuffs, a memory-safe programming language and standard library for Wrangling Untrusted File Formats Safely.'
	depends=(
		"gcc-libs"
		"glibc"
		"sdl2"
		"sdl2_image"
		"xcb-util-image"
		"xcb-util-renderutil"
		"wuffs-license"
	)
	cd source
	declare _bins
	_bins=`ls -1 gen/bin/example-*`
	for _bin in ${_bins}; do
		_name="$(basename "${_bin}" | sed -E -e 's|^example-||')"
		install -vDm755 \
			"${_bin}" \
			"${pkgdir}/usr/bin"/wuffs-"${_name}"
	done
	install -vDm644 -t \
		"${pkgdir}/usr/share/doc/wuffs-examples" \
		example/README.md
	install -vdm644 "${pkgdir}/usr/share/licenses"
	ln -srf \
		"${pkgdir}/usr/share/licenses/wuffs" \
		"${pkgdir}/usr/share/licenses"/wuffs-examples
}

package_wuffs-fuzzers() {
	pkgdesc='Fuzzer programmes for wuffs, a memory-safe programming language and standard library for Wrangling Untrusted File Formats Safely.'
	depends=(
		"gcc-libs"
		"glibc"
		"wuffs-license"
	)

	cd source
	declare _bins
	_bins=`ls -1 gen/bin/fuzz-*`
	for _bin in ${_bins}; do
		_name="$(basename "${_bin}")"
		install -vDm755 \
			"${_bin}" \
			"${pkgdir}/usr/bin"/wuffs-"${_name}"
	done

	install -vDm644 \
		-t "${pkgdir}/usr/share/doc/wuffs-fuzzers" \
		fuzz/c/std/README.md

	install -vdm644 "${pkgdir}/usr/share/licenses"
	ln -srf \
		"${pkgdir}/usr/share/licenses/wuffs" \
		"${pkgdir}/usr/share/licenses"/wuffs-fuzzers
}

package_wuffs-lang() {
	pkgdesc='A memory-safe programming language for Wrangling Untrusted File Formats Safely. Wrangling includes parsing, decoding and encoding. Example file formats include images, audio, video, fonts and compressed archives.'
	depends=(
		"wuffs-license"

		# ractool deps
		glibc
		liblz4.so
		libz.so
		libzstd.so
	)
	provides=(
		"dumbindent=${pkgver}"
		#"handsum=${pkgver}"
		"ractool=${pkgver}"
		"wuffs=${pkgver}"
		"wuffs-c=${pkgver}"
		"wuffsfmt=${pkgver}"
	)
	optdepends=(
		"wuffs-docs: Docs"
	)

	cd source
	export GOPATH="${srcdir}/go"
	export GOBIN="${GOPATH}/bin"
	install -Dvm755 \
		-t "${pkgdir}/usr/bin" \
		"${GOBIN}"/{dumbindent,ractool,wuffs,wuffs-c,wuffsfmt}
	install -vdm644 \
		"${pkgdir}/usr/share/licenses"
	ln -srf \
		"${pkgdir}/usr/share/licenses/wuffs" \
		"${pkgdir}/usr/share/licenses"/wuffs-lang
}

package_wuffs-docs() {
	pkgdesc='Documentation for "Wuffs the Library" and "Wuffs the Language", as well as the corresponding example binaries.'
	depends=("wuffs-license")
	arch=('any')

	cd source
	install -Dvm644 \
		-t "${pkgdir}/usr/share/doc/wuffs" \
		AUTHORS \
		*.md \
		CONTRIBUTORS
	cp -r \
		doc \
		"${pkgdir}/usr/share/doc/wuffs"/
	install -vdm644 \
		"${pkgdir}/usr/share/licenses"
	ln -srf \
		"${pkgdir}/usr/share/licenses/wuffs" \
		"${pkgdir}/usr/share/licenses"/wuffs-docs
}

package_wuffs-license() {
	pkgdesc='Common license for "Wuffs the Library" and "Wuffs the Language", as well as the corresponding example binaries.'
	depends=()
	arch=('any')
	cd source
	install -vDm644 \
		-t "${pkgdir}/usr/share/licenses/wuffs" \
		LICENSE*
	ln -srf \
		"${pkgdir}/usr/share/licenses/wuffs" \
		"${pkgdir}/usr/share/licenses"/wuffs-license
	ln -srf \
		"${pkgdir}/usr/share/licenses/wuffs" \
		"${pkgdir}/usr/share/licenses"/wuffs-license
}