-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPKGBUILD
executable file
·46 lines (40 loc) · 1.32 KB
/
PKGBUILD
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
pkgname=llvm-project
pkgver=r12.012345
pkgrel=1
pkgdesc="build clang for WIN64"
arch=('x86_64')
url="https://clang.llvm.org/"
license=('custom:Apache 2.0 with LLVM Exception')
makedepends=('cmake' 'make' 'mingw-w64-gcc' 'python')
source=(git+/~https://github.com/llvm/llvm-project.git)
#FIXME: why this function doesn't work?
pkgver() {
cd "$srcdir/llvm-project"
printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}
prepare() {
cd "$srcdir/llvm-project"
mkdir -p build
}
build() {
cd "$srcdir/llvm-project/build"
# makepkg would set these environment variables, but they are not proper for cross-compiling using mingw-w64-gcc
unset LDFLAGS CFLAGS CXXFLAGS CHOST CPPFLAGS COMMAND_MODE
cmake ../llvm -DCMAKE_C_COMPILER=/usr/bin/x86_64-w64-mingw32-gcc \
-DCMAKE_CXX_COMPILER=/usr/bin/x86_64-w64-mingw32-g++ \
-DCMAKE_SYSTEM_NAME=Windows \
-DCMAKE_RC_COMPILER=/usr/bin/x86_64-w64-mingw32-windres \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_PROJECTS=clang \
-DCMAKE_INSTALL_PREFIX=/WIN64/$pkgname-$pkgver \
-DCROSS_TOOLCHAIN_FLAGS_NATIVE="-DCMAKE_C_COMPILER=cc;-DCMAKE_CXX_COMPILER=c++"
make -j "$(nproc)"
}
check() {
cd "$srcdir/llvm-project/build"
ls -l bin/clang.exe
}
package() {
cd "$srcdir/llvm-project/build"
DESTDIR="$pkgdir" make install
}