Skip to content

Instantly share code, notes, and snippets.

@bmwalters
Last active November 20, 2018 22:09
Show Gist options
  • Save bmwalters/4506967a306c5c3945b37b69dffab67e to your computer and use it in GitHub Desktop.
Save bmwalters/4506967a306c5c3945b37b69dffab67e to your computer and use it in GitHub Desktop.
Arch PKGBUILD for Vittorio Romeo's OpenHexagon / SSVOpenHexagon
# Maintainer: Bradley Walters <[email protected]>
pkgname=openhexagon-git
pkgver=r1733.4791b23
pkgrel=1
pkgdesc='C++14 FOSS clone of "Super Hexagon"'
arch=('i686' 'x86_64' 'armv6h') # TODO: check these
url="https://vittorioromeo.info/projects.html"
license=('custom:AFL-3.0')
depends=('sfml' 'lua')
makedepends=('git' 'cmake>=3.0' 'zlib') # TODO: is zlib a depends or makedepends?
provides=("openhexagon-git")
conflicts=("openhexagon-git")
source=("$pkgname::git+https://github.com/SuperV1234/SSVOpenHexagon.git"
'git+https://github.com/SuperV1234/SSVOpenHexagonAssets.git'
'git+https://github.com/SuperV1234/SSVMenuSystem.git'
'git+https://github.com/SuperV1234/SSVStart.git'
'git+https://github.com/SuperV1234/SSVUtils.git'
'git+https://github.com/SuperV1234/SSVLuaWrapper.git'
'git+https://github.com/SuperV1234/vrm_pp.git'
'git+https://github.com/SuperV1234/vrm_cmake.git'
'git+https://github.com/LaurentGomila/SFML.git'
'git+https://github.com/meganz/mingw-std-threads.git')
md5sums=('SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP')
pkgver() {
cd "$srcdir/$pkgname"
printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}
prepare() {
cd "$srcdir/$pkgname"
# update submodules
git submodule init
git config submodule.extlibs/SSVMenuSystem.url "$srcdir/SSVMenuSystem"
git config submodule.extlibs/SSVStart.url "$srcdir/SSVStart"
git config submodule.extlibs/SSVUtils.url "$srcdir/SSVUtils"
git config submodule.extlibs/SSVLuaWrapper.url "$srcdir/SSVLuaWrapper"
git config submodule.extlibs/vrm_pp.url "$srcdir/vrm_pp"
git config submodule.extlibs/vrm_cmake.url "$srcdir/vrm_cmake"
git config submodule.extlibs/SFML.url "$srcdir/SFML" # TODO: FROM REPO?
git config submodule.extlibs/mingw-std-threads.url "$srcdir/mingw-std-threads" # TODO: necessary?
git submodule update
}
build() {
cd "$srcdir/$pkgname"
mkdir -p build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make
}
package() {
cd "$srcdir/$pkgname/build"
echo $pkgdir
make install
# files are now installed to $srcdir/$pkgname/_RELEASE (upstream build dir is not configurable)
# TODO: patch upstream to allow configuring build dir in CMakeLists
# HACK: throw everything in /opt (upstream expects them to be next to binary)
# TODO: patch upstream to use sane directory configuration (with XDG)
install -Dm644 "$srcdir/$pkgname"/_RELEASE/ConfigOverrides/* -t "$pkgdir/opt/$pkgname/ConfigOverrides"
install -Dm644 "$srcdir/$pkgname"/_RELEASE/_DOCUMENTATION/* -t "$pkgdir/opt/$pkgname/_DOCUMENTATION"
install -Dm644 "$srcdir/$pkgname"/_RELEASE/*.json -t "$pkgdir/opt/$pkgname"
install -Dm755 "$srcdir/$pkgname"/_RELEASE/SSVOpenHexagon -t "$pkgdir/opt/$pkgname"
cp -r "$srcdir/$pkgname"/_RELEASE/Assets "$pkgdir/opt/$pkgname"
cp -r "$srcdir/$pkgname"/_RELEASE/Packs "$pkgdir/opt/$pkgname"
# copy over additional assets from separate repo
cp -r "$srcdir"/SSVOpenHexagonAssets/_RELEASE/Packs/* "$pkgdir/opt/$pkgname/Packs"
# create launcher script in /usr/bin
mkdir -p $pkgdir/usr/bin
cat << EOF > "$pkgdir/usr/bin/open-hexagon"
#!/usr/bin/sh
cd "/opt/$pkgname"
./SSVOpenHexagon
EOF
chmod 755 "$pkgdir/usr/bin/open-hexagon"
# HACK: create runtime files and set permissions
# see above TODO
touch $pkgdir/opt/$pkgname/log.txt
chmod 666 $pkgdir/opt/$pkgname/log.txt
mkdir -p $pkgdir/opt/$pkgname/Profiles
chmod 777 $pkgdir/opt/$pkgname/Profiles
chmod 666 $pkgdir/opt/$pkgname/config.json
chmod 666 $pkgdir/opt/$pkgname/scores.json
chmod 666 $pkgdir/opt/$pkgname/users.json
# copy license
install -Dm644 "$srcdir/$pkgname"/LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment