mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2026-05-04 12:01:41 +02:00
testing/zig: new aport
https://ziglang.org/ general-purpose programming language designed for robustness, optimality, and maintainability
This commit is contained in:
parent
c653c42eb3
commit
2c0e656d52
54
testing/zig/APKBUILD
Normal file
54
testing/zig/APKBUILD
Normal file
@ -0,0 +1,54 @@
|
||||
# Contributor: Milan P. Stanić <mps@arvanta.net>
|
||||
# Maintainer: Milan P. Stanić <mps@arvanta.net>
|
||||
pkgname="zig"
|
||||
pkgver="0.5.0"
|
||||
pkgrel=0
|
||||
pkgdesc="general-purpose programming language designed for robustness, optimality, and maintainability"
|
||||
url="https://ziglang.org/"
|
||||
arch="x86_64"
|
||||
license="MIT"
|
||||
options="!check" # works, but fail at the end, need to be fixed
|
||||
makedepends="cmake clang-dev clang-libs llvm9-libs llvm-dev lld-dev libstdc++
|
||||
zlib-static libxml2-dev llvm9-static clang-static lld-static"
|
||||
subpackages="$pkgname-dev"
|
||||
source="https://ziglang.org/download/$pkgver/zig-$pkgver.tar.xz
|
||||
fix-build.zig.patch"
|
||||
|
||||
builddir="$srcdir"/$pkgname-$pkgver
|
||||
|
||||
build() {
|
||||
if [ "$CBUILD" != "$CHOST" ]; then
|
||||
CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
|
||||
fi
|
||||
cmake \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_INSTALL_PREFIX=/usr \
|
||||
-DZIG_FORCE_EXTERNAL_LLD=ON \
|
||||
-DZIG_SKIP_INSTALL_LIB_FILES=ON \
|
||||
-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
|
||||
-DCMAKE_C_FLAGS="$CFLAGS" \
|
||||
${CMAKE_CROSSOPTS} .
|
||||
make
|
||||
}
|
||||
|
||||
check() {
|
||||
./zig build test
|
||||
}
|
||||
|
||||
package() {
|
||||
if [ "$CBUILD" != "$CHOST" ]; then
|
||||
CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
|
||||
fi
|
||||
cmake \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_INSTALL_PREFIX=/usr \
|
||||
-DZIG_FORCE_EXTERNAL_LLD=ON \
|
||||
-DZIG_SKIP_INSTALL_LIB_FILES=OFF \
|
||||
-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
|
||||
-DCMAKE_C_FLAGS="$CFLAGS" \
|
||||
${CMAKE_CROSSOPTS} .
|
||||
make DESTDIR="$pkgdir" install
|
||||
}
|
||||
|
||||
sha512sums="1ce479077d2501c160bcac318b3d59e66921207855f56d900b9a59c44b14116639de10c5b578663b4963ccc8d49bb0d5aa75afb8987f5df1950037248561d1e2 zig-0.5.0.tar.xz
|
||||
9972f52663c061df59363215e1624773d28a1a85c473250f0e16b78d59c6f9e8987267e55148609b0cbad5f722d365aad7554d7f547060c377edd91dd371ff82 fix-build.zig.patch"
|
||||
41
testing/zig/fix-build.zig.patch
Normal file
41
testing/zig/fix-build.zig.patch
Normal file
@ -0,0 +1,41 @@
|
||||
diff --git a/build.zig b/build.zig
|
||||
index 390f1594..ca78bdf1 100644
|
||||
--- a/build.zig
|
||||
+++ b/build.zig
|
||||
@@ -373,6 +373,7 @@ fn addLibUserlandStep(b: *Builder, mode: builtin.Mode) void {
|
||||
artifact.bundle_compiler_rt = true;
|
||||
artifact.setTarget(builtin.arch, builtin.os, builtin.abi);
|
||||
artifact.setBuildMode(mode);
|
||||
+ artifact.force_pic = true;
|
||||
if (mode != .Debug) {
|
||||
artifact.strip = true;
|
||||
}
|
||||
diff --git a/lib/std/build.zig b/lib/std/build.zig
|
||||
index c640f6e8..cc062f3a 100644
|
||||
--- a/lib/std/build.zig
|
||||
+++ b/lib/std/build.zig
|
||||
@@ -1488,6 +1488,9 @@ pub const LibExeObjStep = struct {
|
||||
|
||||
dynamic_linker: ?[]const u8 = null,
|
||||
|
||||
+ /// Position Independent Code
|
||||
+ force_pic: ?bool = null,
|
||||
+
|
||||
const LinkObject = union(enum) {
|
||||
StaticPath: []const u8,
|
||||
OtherStep: *LibExeObjStep,
|
||||
@@ -2314,6 +2317,14 @@ pub const LibExeObjStep = struct {
|
||||
try zig_args.append(builder.pathFromRoot(dir));
|
||||
}
|
||||
|
||||
+ if (self.force_pic) |pic| {
|
||||
+ if (pic) {
|
||||
+ try zig_args.append("-fPIC");
|
||||
+ } else {
|
||||
+ try zig_args.append("-fno-PIC");
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
if (self.kind == Kind.Test) {
|
||||
try builder.spawnChild(zig_args.toSliceConst());
|
||||
} else {
|
||||
Loading…
x
Reference in New Issue
Block a user