196 lines
6 KiB
Text
196 lines
6 KiB
Text
# Maintainer: Antoine Martin (ayakael) <dev@ayakael.net>
|
|
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
|
|
# Contributor: Antoine Martin (ayakael) <dev@ayakael.net>
|
|
pkgname=loomio
|
|
pkgver=2.21.4
|
|
_gittag=v$pkgver
|
|
pkgrel=0
|
|
pkgdesc="A collaborative decision making tool"
|
|
url="https://github.com/loomio/loomio"
|
|
arch="x86_64"
|
|
license="MIT"
|
|
depends="
|
|
postgresql
|
|
postgresql-contrib
|
|
python3
|
|
redis
|
|
ruby3.2
|
|
ruby3.2-bundler
|
|
ruby3.2-grpc
|
|
vips
|
|
npm
|
|
procps-ng
|
|
"
|
|
makedepends="
|
|
cmd:chrpath
|
|
ruby3.2-dev
|
|
nodejs
|
|
openssl-dev
|
|
readline-dev
|
|
zlib-dev
|
|
libpq-dev
|
|
libffi-dev
|
|
imagemagick-dev
|
|
"
|
|
pkgusers="loomio"
|
|
pkggroups="loomio www-data"
|
|
install="$pkgname.pre-install $pkgname.post-install $pkgname.post-upgrade"
|
|
subpackages="$pkgname-openrc"
|
|
source="
|
|
$pkgname-$pkgver.tar.gz::https://github.com/loomio/loomio/archive/refs/tags/v$pkgver.tar.gz
|
|
bin-wrapper.in
|
|
loomio.confd
|
|
loomio.logrotate
|
|
loomio.sidekiq.initd
|
|
loomio.vue.initd
|
|
loomio.initd
|
|
"
|
|
_prefix="usr/lib/webapps/loomio"
|
|
|
|
export BUNDLE_DEPLOYMENT=true
|
|
export BUNDLE_FORCE_RUBY_PLATFORM=true
|
|
export BUNDLE_FROZEN=true
|
|
export BUNDLE_JOBS=${JOBS:-2}
|
|
|
|
prepare() {
|
|
local sysgemdir=$(ruby -e 'puts Gem.default_dir')
|
|
|
|
default_prepare
|
|
|
|
# Allow use of any bundler
|
|
sed -i -e '/BUNDLED/,+1d' Gemfile.lock
|
|
|
|
# Allow use of any platform
|
|
sed -i -e 's/PLATFORMS/PLATFORMS\n ruby/' Gemfile.lock
|
|
|
|
# Some gems are broken, so we copy our fixed version
|
|
# instead of installing it from RubyGems using Bundler.
|
|
mkdir -p vendor/gems/grpc/src/ruby/lib/grpc
|
|
cp -r "$sysgemdir"/gems/grpc-*/* vendor/gems/grpc/
|
|
cp "$sysgemdir"/specifications/grpc-*.gemspec \
|
|
vendor/gems/grpc/grpc.gemspec
|
|
cp "$sysgemdir"/extensions/*/*/grpc-*/grpc/*.so \
|
|
vendor/gems/grpc/src/ruby/lib/grpc/
|
|
}
|
|
|
|
build() {
|
|
local bundle_without='exclude development test'
|
|
|
|
bundle config --local build.ffi --enable-system-libffi
|
|
bundle config --local build.vips --enable-system-libraries
|
|
bundle config --local build.nokogiri --use-system-libraries \
|
|
--with-xml2-include=/usr/include/libxml2 \
|
|
--with-xslt-include=/usr/include/libxslt
|
|
bundle config --local build.google-protobuf '-- --with-cflags=-D__va_copy=va_copy'
|
|
|
|
msg "Installing Ruby gems..."
|
|
bundle config --local without "$bundle_without"
|
|
bundle config --local path "vendor/bundle"
|
|
|
|
bundle install --no-cache
|
|
|
|
msg "Precompiling static assets..."
|
|
bundle exec bootsnap precompile --gemfile app/ lib/
|
|
|
|
# Create executables in bin/*.
|
|
# See also https://github.com/bundler/bundler/issues/6149.
|
|
bundle binstubs --force bundler puma sidekiq
|
|
|
|
# Remove faulty RPATH.
|
|
chrpath -d vendor/bundle/ruby/*/gems/*/lib/nokogiri/*/nokogiri.so
|
|
|
|
# cp grpc so
|
|
cp vendor/gems/grpc/src/ruby/lib/grpc/grpc_c.so vendor/bundle/ruby/*/gems/grpc*/src/ruby/lib/grpc/.
|
|
rm -R vendor/bundle/ruby/*/gems/grpc*/src/ruby/lib/grpc/3* vendor/bundle/ruby/*/gems/grpc*/src/ruby/lib/grpc/2*
|
|
|
|
msg "Installing npm modules..."
|
|
cd vue
|
|
# force as vite-plugin-yaml hasn't updated their peerDependencies list yet
|
|
npm ci --force
|
|
npm run build
|
|
}
|
|
|
|
package() {
|
|
local destdir="$pkgdir/$_prefix"
|
|
local datadir="$pkgdir/var/lib/loomio"
|
|
local file dest
|
|
|
|
# Make directories
|
|
install -dm 755 \
|
|
"$(dirname $destdir)" \
|
|
"$datadir"
|
|
|
|
mkdir -p "$(dirname $destdir)"
|
|
cp -R "$builddir" "$destdir"
|
|
|
|
cd "$destdir"/vendor/bundle/ruby/*/
|
|
|
|
# Remove tests, documentations and other useless files.
|
|
find gems/ \( -name 'doc' \
|
|
-o -name 'spec' \
|
|
-o -name 'test' \) \
|
|
-type d -maxdepth 2 -exec rm -fr "{}" +
|
|
find gems/ \( -name 'README*' \
|
|
-o -name 'CHANGELOG*' \
|
|
-o -name 'CONTRIBUT*' \
|
|
-o -name '*LICENSE*' \
|
|
-o -name 'Rakefile' \
|
|
-o -name '.*' \) \
|
|
-type f -delete
|
|
|
|
# Remove build logs and cache.
|
|
rm -rf build_info/ cache/
|
|
find extensions/ \( -name gem_make.out -o -name mkmf.log \) -delete
|
|
|
|
cd "$destdir"
|
|
|
|
# Install and symlink config files.
|
|
for file in database.yml.postgresql puma.rb sidekiq.yml; do
|
|
dest="$(basename "${file/.postgresql/}")"
|
|
install -m640 -g loomio -D config/$file "$pkgdir"/etc/loomio/$dest
|
|
ln -sf /etc/loomio/$dest "$pkgdir"/$_prefix/config/${file/.postgrewsql/}
|
|
done
|
|
|
|
# This file will be generated by the post-install script, just prepare symlink.
|
|
ln -sf /etc/loomio/secrets.yml config/secrets.yml
|
|
# These shouldn't be necessary, they are all configurable, but OmniBus
|
|
|
|
cat > "$datadir"/.profile <<-EOF
|
|
export RAILS_ENV=production
|
|
export NODE_ENV=production
|
|
export EXECJS_RUNTIME=Disabled
|
|
EOF
|
|
|
|
# Install wrapper scripts to /usr/bin.
|
|
local name; for name in rake rails; do
|
|
sed "s/__COMMAND__/$name/g" "$srcdir"/bin-wrapper.in \
|
|
> "$builddir"/loomio-$name
|
|
install -m755 -D "$builddir"/loomio-$name "$pkgdir"/usr/bin/loomio-$name
|
|
done
|
|
|
|
for file in $pkgname $pkgname.sidekiq $pkgname.vue; do
|
|
install -m755 -D "$srcdir"/$file.initd "$pkgdir"/etc/init.d/$file
|
|
done
|
|
|
|
install -m644 -D "$srcdir"/loomio.confd \
|
|
"$pkgdir"/etc/conf.d/loomio
|
|
|
|
install -m644 -D "$srcdir"/loomio.logrotate \
|
|
"$pkgdir"/etc/logrotate.d/loomio
|
|
}
|
|
|
|
assets() {
|
|
depends=""
|
|
|
|
amove $_prefix/public/assets
|
|
}
|
|
|
|
sha512sums="
|
|
72a1238c1eaa3b963bd20a09d4fc2e52798264779bdf06d3f32891f2880d246059c77381329d1274bfa5979a35740017f0ced324f88b205369e77335b403ffba loomio-2.21.4.tar.gz
|
|
6cd4bb030660a9f4697eeb7c6de3f7509558aab3651e68218583dfeea56634f3b9f58acb50c7c9a4188a38c19434a815dd6c347e30207c4c0ae028c8dcb6ccaf bin-wrapper.in
|
|
0f1c91fbd4b8099f0a115705d5af799e4492fa2a0fd54175f3bfbfb5be1122bd7fd73a7709695c7caf2dcc667f3b8715051c24f424472e1115753e43a38fdf50 loomio.confd
|
|
1ecb0717cd5f04b894467b21d226b98d8f83b8f62afbf8da7edd57973aeabb13d121e9061cc48aec7572b1c710e82c8b44a1cedc0a924efd4bc4a124b3afe9a8 loomio.logrotate
|
|
c5dae2b6f9a23853c3c7ac068d97a7b0269b1775f6e0169c3d8999ec67c2baf3545515ea21037e882d900b15a7abf9061dd5a584bdc82c347b54d8c134f6d7a4 loomio.sidekiq.initd
|
|
f774954d8b06aacab27af9593b1b12fbe18ec2d0593dd4f82e4d3dfbc7e325fb1a423347fd974a2ec6665776a6cfe85f255f4fd7493c97eb840f34eb7fbdb329 loomio.vue.initd
|
|
645637c4112ec91ec2ea6022713e77a8ee76c0f0a81f9adf1f9210b52a578e94b5b02f0b6244b173905f580f72dc362b5434c714aae11e3619f73af223891bb8 loomio.initd
|
|
"
|