commit 9dc77c6b86da07870dbe3d578ffffbac9792a951 Author: Chewing_Bever Date: Mon Feb 13 12:20:09 2023 +0100 chore: added initial vlang stuff diff --git a/.woodpecker/vlang.yml b/.woodpecker/vlang.yml new file mode 100644 index 0000000..08dcd3a --- /dev/null +++ b/.woodpecker/vlang.yml @@ -0,0 +1,34 @@ +matrix: + PLATFORM: + - linux/amd64 + - linux/arm64 + +platform: ${PLATFORM} + +when: + path: 'vlang/PKGBUILD.vlang' + +pipeline: + build: + image: 'git.rustybever.be/vieter-v/vieter-builder' + commands: + # Add the vieter repository so we can use the compiler + - echo -e '[vieter]\nServer = https://arch.r8r.be/$repo/$arch\nSigLevel = Optional' >> /etc/pacman.conf + # Update packages + - pacman -Syu --noconfirm + # Create non-root user to perform build & switch to their home + - groupadd -g 1000 builder + - useradd -mg builder builder + - chown -R builder:builder "$PWD" + - "echo 'builder ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers" + - su builder + - cd vlang + - makepkg -s --noconfirm --needed + + publish: + image: 'curlimages/curl' + commands: + # Publish the package + - 'for pkg in $(ls -1 *.pkg*); do curl -XPOST -T "$pkg" -H "X-API-KEY: $VIETER_API_KEY" https://arch.r8r.be/vieter/publish; done' + secrets: + - vieter_api_key diff --git a/README.md b/README.md new file mode 100644 index 0000000..a7445f2 --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +# Build tools + +Vieter requires several tools to be developed, one of which being a specific +version of Vlang. This repository manages Dockerfiles & other packages for +these various tools. diff --git a/vlang/PKGBUILD.vlang b/vlang/PKGBUILD.vlang new file mode 100644 index 0000000..6c2cc57 --- /dev/null +++ b/vlang/PKGBUILD.vlang @@ -0,0 +1,65 @@ +# Maintainer: Jef Roosens +# Contributor: Logan Magee + +_v_commit_sha=d1f57ead713c8e5254d8cef22991e6409dc1f06b +_vc_commit_sha=1f7f0244f352d41122bb306446d98ae3de4e6b02 + +pkgname=vieter-vlang +pkgver="$(echo "${_v_commit_sha}" | cut -c -8)" +pkgrel=1 +epoch=1 +pkgdesc='Locked Vlang version used to develop Vieter' +arch=('x86_64' 'aarch64') +url='https://vlang.io' +license=('MIT') +depends=('glibc') +optdepends=('glfw: Needed for graphics support' + 'freetype2: Needed for graphics support' + 'openssl: Needed for http support') +makedepends=('git') +conflicts=('v' 'vlang') +source=("${pkgname}.zip::https://github.com/vlang/v/archive/${_v_commit_sha}.zip" + "${pkgname}-vc.zip::https://github.com/vlang/vc/archive/${_vc_commit_sha}.zip") +sha256sums=('6886469efe21463276d682e658f415ea1167a9efb41bf2a8fd6577abb753f2e4' + '91b6b4b576659f222e8aa3569124e95e17feb5c0b436ecc0f30db04ff24f6e39') +sha512sums=('81481854928f31c2cfc3c49acaa9b579712bbfa66cf2a31c5a2df2af47511b9fb62576844cdf1bcf1512b8cea58d4d637ad44110d2a73a0b55b6f41efa984b25' + '8eab18f5d01a417c0cdbfd995fdd570ca92fd2ce245eda08762de0021487fff1c6084c91fcc7fcdfd37aa618d2f71c0222df6f434b014fe3b71d284795762b0b') + +prepare() { + # In case the previous directory still exists + rm -rf "v-${_v_commit_sha}/vc" + + mv "vc-${_vc_commit_sha}" "v-${_v_commit_sha}/vc" + + # We have to set local=1 because we manually download a specific vc + # version. This flag also disables downloading tcc, so we do that + # beforehand. + make -C "v-${_v_commit_sha}" fresh_tcc +} + +build() { + cd "v-${_v_commit_sha}" + + CFLAGS="" LDFLAGS="" make prod=1 local=1 + + # Compile all tools + LDFLAGS='' ./v build-tools +} + +package() { + cd "v-${_v_commit_sha}" + + 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" +} + +# vim: ft=bash diff --git a/vlang/PKGBUILD.vls b/vlang/PKGBUILD.vls new file mode 100644 index 0000000..79b10df --- /dev/null +++ b/vlang/PKGBUILD.vls @@ -0,0 +1,50 @@ +# Maintainer: Jef Roosens + +pkgname=vieter-vls +pkgver=r678.607138c +pkgrel=1 +pkgdesc='Locked version used with for Vieter development.' +arch=('x86_64' 'aarch64') + +url='https://github.com/vlang/vls' +license=('MIT') + +depends=('glibc' 'vieter-vlang') +makedepends=('git') + +source=("${pkgname}::git+https://github.com/vlang/vls") +md5sums=('SKIP') + +pkgver() { + cd "${pkgname}" + + echo "r$(git rev-list --count HEAD).$(git rev-parse --short HEAD)" +} + +build() { + cd "${pkgname}" + + v run build.vsh gcc + + msg "Building treesitter grammar..." + + # Building with -prod is required because otherwise, the binary contains + # tcc symbols which isn't usually installed on the user's system. + v -cc gcc -shared -prod tree_sitter_v +} + +package() { + # Install vls + install -dm755 "${pkgdir}/usr/bin" + install -Dm755 "${pkgname}/bin/vls" "${pkgdir}/usr/bin/vls" + install -Dm644 "${pkgname}/LICENSE" -t "${pkgdir}/usr/share/licenses/${pkgname}" + + # Install treesitter grammar + # This package installs the parser & queries for Neovim in its runtimepath + install -dm755 "${pkgdir}/usr/share/nvim/runtime/parser" + install -dm755 "${pkgdir}/usr/share/nvim/runtime/queries/v" + install -Dm755 "${pkgname}/tree_sitter_v/tree_sitter_v.so" "${pkgdir}/usr/share/nvim/runtime/parser/v.so" + install -m644 "${pkgname}/tree_sitter_v/queries"/* "${pkgdir}/usr/share/nvim/runtime/queries/v" +} + +# vim: ft=bash