From 1791f0e5e74ef9865b1a64e9aaa369935f9ebba2 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Tue, 6 Dec 2022 18:40:59 +0100 Subject: [PATCH] testing/vlang: new aport Simple, fast, safe, compiled. For developing maintainable software. https://vlang.io/ --- testing/vlang/APKBUILD | 78 +++++++++++++++++++++++++++++++ testing/vlang/explicit_cast.patch | 11 +++++ 2 files changed, 89 insertions(+) create mode 100644 testing/vlang/APKBUILD create mode 100644 testing/vlang/explicit_cast.patch diff --git a/testing/vlang/APKBUILD b/testing/vlang/APKBUILD new file mode 100644 index 0000000..37654db --- /dev/null +++ b/testing/vlang/APKBUILD @@ -0,0 +1,78 @@ +# Contributor: Jakob Meier +# Maintainer: Jakob Meier +pkgname=vlang +pkgver=0.3.2 +pkgrel=2 +pkgdesc="Simple, fast, safe, compiled language for developing maintainable software." +url="https://vlang.io" +arch="all" +license="MIT" +depends="gc-dev" +makedepends="tcc clang" +checkdepends="" +subpackages="" +source="vlang-$pkgver.tar.gz::https://github.com/vlang/v/archive/refs/tags/$pkgver.tar.gz +vc.c::https://github.com/vlang/vc/raw/master/v.c +tcc.tar.gz::https://github.com/vlang/tccbin/archive/refs/heads/master.tar.gz +explicit_cast.patch" +builddir="$srcdir/v-$pkgver" + +build() { + mkdir vc; + cp $srcdir/vc.c vc/v.c + + cp $srcdir/tccbin-master -r thirdparty/tcc + + # disable `v up` + # as seen in AUR package + echo "println('v up is disabled; see the AUR page for more information.')" \ + > 'cmd/tools/vup.v' + + # cannot rely on prebuild tcc libgc.a + # needs gc-dev + ln -s /usr/lib/libgc.a thirdparty/tcc/lib/libgc.a + + echo building v using c + tcc -std=gnu11 -w -o v1 vc/v.c -bt10 -lm -lexecinfo -lpthread + echo building stage 2 + ./v1 -no-parallel -o v2 -cc tcc cmd/v + echo building v staging + ./v2 -o v -cc tcc cmd/v + + echo cleaning old files + rm -rf v1 v2 vc/ + + echo finalizing install + ./v run ./cmd/tools/detect_tcc.v + + echo building tools + ./v build-tools +} + +check() { + # tests take ages + # also some of them seem quite useless + # and others fail + # make check + echo who cares right? +} + +package() { + install -d $pkgdir/usr/lib/vlang $pkgdir/usr/share/vlang $pkgdir/usr/bin + install -Dm644 LICENSE pkgdir/usr/share/licenses/$pkgname/LICENSE + install -Dm755 v $pkgdir/usr/lib/vlang + cp -a cmd $pkgdir/usr/lib/vlang/ + cp -a examples $pkgdir/usr/share/vlang/ + cp -a thirdparty $pkgdir/usr/lib/vlang/ + cp -a vlib $pkgdir/usr/lib/vlang/ + cp v.mod $pkgdir/usr/lib/vlang/ + ln -s /usr/lib/vlang/v $pkgdir/usr/bin/v + + touch $pkgdir/usr/lib/vlang/cmd/tools/.disable_autorecompilation +} +sha512sums=" +ffe9880187ac8d20468c2c625c0f624e51096f78405d0af35444ce6eb25067b7f7ef35d6d30907eea339902749be96d715af8df33e5d5427d007337d375bb642 vlang-0.3.2.tar.gz +c8714a149d03e73e909dd298c1aae6a34190acc64d4988fb388dbd03d2d58882ca1bc09c0a4a85557ca511306426d9aae356506d2ee118caf08e0a4899cfe089 vc.c +ee9f916092bafd1dfc782354291443261fd33bad7fe9663422211f36cb75b59b54f85a5b8a68ce5d7c222ef13cbb3379434b13e4af3f89a78fdadbab9425a22b tcc.tar.gz +474cfbe8952640d49a80a8278dcedfb0a7ecca01ea83aa5acb7514530b8ac5efa08ecbd9d572608069855c1936e1de51fbbb11b7fd262980612269d4979a89fe explicit_cast.patch +" diff --git a/testing/vlang/explicit_cast.patch b/testing/vlang/explicit_cast.patch new file mode 100644 index 0000000..ae4af8e --- /dev/null +++ b/testing/vlang/explicit_cast.patch @@ -0,0 +1,11 @@ +--- ./vlib/rand/constants/constants.v.old ++++ ./vlib/rand/constants/constants.v +@@ -3,7 +3,7 @@ + // Commonly used constants across RNGs - some taken from "Numerical Recipes". + pub const ( + lower_mask = u64(0x00000000FFFFFFFF) +- max_u32 = 0xFFFFFFFF ++ max_u32 = u32(0xFFFFFFFF) + max_u64 = u64(0xFFFFFFFFFFFFFFFF) + max_u32_as_f32 = f32(max_u32) + 1 + max_u64_as_f64 = f64(max_u64) + 1 -- 2.38.5