Skip to content

Instantly share code, notes, and snippets.

@EndlessEden
Last active October 21, 2020 17:10
Show Gist options
  • Save EndlessEden/75976f4253a1d38a6ee3cef833e39ff2 to your computer and use it in GitHub Desktop.
Save EndlessEden/75976f4253a1d38a6ee3cef833e39ff2 to your computer and use it in GitHub Desktop.
cjs-git updated PKGBUILD
# Maintainer: Eli Schwartz <eschwartz@archlinux.org>
# Contributor: Alexandre Filgueira <alexfilgueira@cinnarch.com>
# Contributor: Ionut Biru <ibiru@archlinux.org>
pkgname=cjs-git
pkgver=4.7.0.gbefc11ad
pkgrel=1
pkgdesc="Javascript Bindings for Cinnamon"
arch=('i686' 'x86_64')
url="https://github.com/linuxmint/${pkgname%-git}"
license=('GPL')
depends=('dbus-glib' 'gtk3' 'gobject-introspection-runtime-git' 'js52')
makedepends=('git' 'autoconf-archive' 'gobject-introspection-git' 'sysprof-git' 'meson-git')
checkdepends=('xorg-server-xvfb')
provides=("${pkgname%-git}")
conflicts=("${pkgname%-git}")
source=("git+${url}.git")
sha512sums=('SKIP')
pkgver() {
cd "${srcdir}"/${pkgname%-git}
local version=$(cat meson.build | grep -m1 project | sed -e 's/,/\n/g' | tail -4 | head -1 | sed -e "s/version: //g" | sed -e "s/'//g")
local versionrev=$(git describe --long | sed -e 's/-/\n/g' | tail -1)
printf $version.$versionrev
}
#prepare() {
# cd "${srcdir}"/${pkgname%-git}
#
# autoreconf -fi
#}
build() {
cd "${srcdir}"/${pkgname%-git}
# fix -mfpu= flags that break a build e.g. for neon on armv7 due to
# basically makepkg.conf being "bad' with default CFLAGS having
# -mfpu=vfpv3-d16
export CFLAGS=`echo -n $CFLAGS | sed 's/-mfpu=vfpv3-d16/-mfpu=neon-vfpv4/g'`
export CFLAGS="$CFLAGS -fvisibility=hidden"
export CXXFLAGS="$CXXFLAGS -fvisibility=hidden"
# this is so this will build on ALARM on a raspberry pi with 1GB RAM...
# and ninja doesnt do MAKEFLAKGS or NINJAFLAGS thus have to pass -j N
MEM=`free -m | head -2 | tail -1 | awk '{printf("%s", $7);}'`
if test "$MEM" -lt 300; then MEM=300; fi
J=`expr $MEM / 300`
CPUS=`echo /sys/devices/system/cpu/cpu[0-9]* | wc -w`
if test "$J" -gt $CPUS; then J=$CPUS; fi
if test "$J" -lt 1; then J=1; fi
echo "Free Mem: $MEM M, using $J threads for build"
arch-meson --prefix=/usr \
--libexecdir=/usr/lib \
--buildtype=release \
--default-library=shared \
-Dinstalled_tests=false \
-Ddtrace=false \
-Dbsymbolic_functions=true \
-Dskip_dbus_tests=true \
-Dskip_gtk_tests=true \
-Denable_tests=false \
. build
#https://bugzilla.gnome.org/show_bug.cgi?id=656231
sed -i -e 's/-D_FORTIFY_SOURCE=2 --cflags-end/-D_FORTIFY_SOURCE=2 -O1 --cflags-end/g' build/build.ninja
sed -i -e 's/-D_FORTIFY_SOURCE=2 --cflags-end/-D_FORTIFY_SOURCE=2 -O1 --cflags-end/g' build/build.ninja
sed -i -e 's|build all: phony libcjs-jsapi.a libcjs.so.0.0.0 CjsPrivate-1.0.gir CjsPrivate-1.0.typelib cjs-console test/gjs-tests installed-tests/js/minijasmine installed-tests/js/libregress.so installed-tests/js/libwarnlib.so installed-tests/js/libgimarshallingtests.so installed-tests/js/gschemas.compiled installed-tests/js/GIMarshallingTests-1.0.typelib installed-tests/js/Regress-1.0.typelib installed-tests/js/WarnLib-1.0.typelib|build all: phony libcjs-jsapi.a libcjs.so.0.0.0 CjsPrivate-1.0.gir CjsPrivate-1.0.typelib cjs-console|g' build/build.ninja
ninja -j $J -C build
}
#check() {
# cd "${srcdir}"/${pkgname%-git}
#
# # Needs a display
# xvfb-run meson test build || :
#}
package() {
cd "${srcdir}"/${pkgname%-git}
DESTDIR="$pkgdir" ninja -C build install
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment