Files
chromebrew/packages/flatpak.rb
Cassandra Watergate d6e779ccd3 Crew profile base (#5503)
* Make basic crew-profile-base package

* Use crew consts

* Upgrade to 0.0.2-pre2

* Convert aa* to cf*

* Docbook

* aa* to dz*

* docbook-xsl

* through fz* and fix environment variables

* through mz*

* through pz*

* through zz*

* fix crew-profile-base

* upgrade crew-profile-base

* major crew-profile-base changes

* Upgrade crew-profile-base and fix xdg-base

* fix sha256sum

* Remove stale files

* pkgsrc and sommelier

* Add crew-profile-base to core packages and ready for merging

* Bump versions

* prevent conflicts with #5494

* fix sha256sum

* fix fop

* profile.d is not ours

* fix bash

* Upgrade crew-profile-base to 0.0.1-pre6 and fix bash

* Remove self-referencing comment

* Add binaries, fix rust, fix #{@ver}

* move compatibility line

* add core mandb deps back

* File.exists? => File.exist?

* deduplicate @env

* update packages

* Fix gdk_pixbug source url

* Add binaries, use rubocop style fixes

* Update cf from 6.36.1-1 to 6.53.0

* fix sl

* fix depot tools

* remove apulse since it conflicts with pulseaudio.

* refactor crew_profile_base

* first tranche of builds

* go

* add cf

* hunspell

* transmission

* clean up dependency & env situation for gdk_pixbuf

* fix gettext

* fix nano

* fix intel-media-driver

* add zziplib for texlive

* fix texlive

* split fuse for flatpak

* fix flatpak

* delete rack (broken and unmaintained)

* fix packer completion

* modify and fix sl

* fix s

* fix stressng

* fix stack

* Add TMPDIR

* Remove TMPDIR from build files

* Fix aws2 version

* Go: remove extraneous dependency

* hunspell_fr_fr: use french in description

* intel media driver: remove case x86_64

* aws2: quickfix

* everything but texlive

* texlive

* fix stressng

* Delete pkgsrc.rb

* add back pkgsrc

Co-authored-by: Satadru Pramanik <satadru@gmail.com>
Co-authored-by: Ed Reel <edreel@gmail.com>
Co-authored-by: satmandu <satadru@umich.edu>
2021-04-08 21:49:18 -05:00

155 lines
6.2 KiB
Ruby

require 'package'
class Flatpak < Package
description 'Flatpak is a system for building, distributing, and running sandboxed desktop applications on Linux.'
homepage 'https://flatpak.org'
@_ver = '1.10.2'
version "#{@_ver}+1"
license 'LGPL-2.1+'
compatibility 'all'
source_url "https://github.com/flatpak/flatpak/releases/download/#{@_ver}/flatpak-#{@_ver}.tar.xz"
source_sha256 'db152739d072f8ff299e4e888d8963a1b4538da7b10e0b86525be438f2e1dde4'
binary_url({
aarch64: 'https://dl.bintray.com/chromebrew/chromebrew/flatpak-1.10.2+1-chromeos-armv7l.tar.xz',
armv7l: 'https://dl.bintray.com/chromebrew/chromebrew/flatpak-1.10.2+1-chromeos-armv7l.tar.xz',
i686: 'https://dl.bintray.com/chromebrew/chromebrew/flatpak-1.10.2+1-chromeos-i686.tar.xz',
x86_64: 'https://dl.bintray.com/chromebrew/chromebrew/flatpak-1.10.2+1-chromeos-x86_64.tar.xz'
})
binary_sha256({
aarch64: 'f03b38526bd4874d0e917bac2e743929f8e118ab67796ee088f36e4712d4c35b',
armv7l: 'f03b38526bd4874d0e917bac2e743929f8e118ab67796ee088f36e4712d4c35b',
i686: 'cd76a117df4c1757410dda6f17ac5d1a46a0028ab3116ae3fea5af602774a1d4',
x86_64: 'ae83c2515abec6eb9969b69d838280f70f620f51ad21231ce5e297c87f5cff5c'
})
depends_on 'appstream_glib'
depends_on 'bubblewrap'
depends_on 'dconf'
depends_on 'fuse2'
depends_on 'libevent'
depends_on 'libostree'
depends_on 'libsoup2'
depends_on 'polkit'
depends_on 'pulseaudio'
depends_on 'pyparsing'
depends_on 'xdg_base'
depends_on 'xdg_dbus_proxy'
depends_on 'xmlto' => :build
def self.patch
# Use fuse3
# system "sed -i 's:PKG_CHECK_MODULES(FUSE, fuse >= 2.9.2):PKG_CHECK_MODULES(FUSE, fuse3 >= 3.1.1):' configure.ac"
# system "sed -i 's:#define FUSE_USE_VERSION 26:#define FUSE_USE_VERSION 31:' revokefs/main.c"
# Source has libglnx repo as submodule
@git_dir = 'libglnx'
@git_hash = '4c9055ac08bb64dca146724f488cce4c1ce4c628'
@git_url = 'https://gitlab.gnome.org/GNOME/libglnx.git'
FileUtils.rm_rf(@git_dir)
FileUtils.mkdir_p(@git_dir)
Dir.chdir @git_dir do
system 'git init'
system "git remote add origin #{@git_url}"
system "git fetch --depth 1 origin #{@git_hash}"
system 'git checkout FETCH_HEAD'
end
# Source has bubblewrap repo as submodule
@git_dir = 'bubblewrap'
@git_hash = 'e1b11e65929f425815f2924489d3fefd453dedd9'
@git_url = 'https://github.com/containers/bubblewrap.git'
FileUtils.rm_rf(@git_dir)
FileUtils.mkdir_p(@git_dir)
Dir.chdir @git_dir do
system 'git init'
system "git remote add origin #{@git_url}"
system "git fetch --depth 1 origin #{@git_hash}"
system 'git checkout FETCH_HEAD'
end
# Source has variant-schema-compiler repo as submodule
@git_dir = 'variant-schema-compiler'
@git_hash = 'd9af1f4324d912634216d69118100583fc1dcd26'
@git_url = 'https://gitlab.gnome.org/alexl/variant-schema-compiler.git'
FileUtils.rm_rf(@git_dir)
FileUtils.mkdir_p(@git_dir)
Dir.chdir @git_dir do
system 'git init'
system "git remote add origin #{@git_url}"
system "git fetch --depth 1 origin #{@git_hash}"
system 'git checkout FETCH_HEAD'
end
end
def self.build
system 'env NOCONFIGURE=1 ./autogen.sh'
system 'filefix'
system "env BWRAP=#{CREW_PREFIX}/bin/bwrap \
CFLAGS='-pipe -flto=auto -fuse-ld=gold' \
CXXFLAGS='-pipe -flto=auto -fuse-ld=gold' \
LDFLAGS='-flto=auto' \
./configure #{CREW_OPTIONS} \
--with-system-install-dir=#{CREW_PREFIX}/var/lib/flatpak \
--localstatedir=#{CREW_PREFIX}/var \
--enable-sandboxed-triggers \
--with-priv-mode=none \
--without-systemd \
--with-system-fonts-dir=#{CREW_PREFIX}/share/fonts:/usr/share/fonts \
--with-system-font-cache-dirs=/usr/share/cache/fontconfig:#{CREW_PREFIX}/cache/fontconfig \
--disable-documentation \
--disable-maintainer-mode \
--enable-xauth \
--with-system-dbus-proxy \
--with-system-bubblewrap"
system 'make'
end
def self.install
system 'make', "DESTDIR=#{CREW_DEST_DIR}", 'install'
FileUtils.mkdir_p "#{CREW_DEST_PREFIX}/libexec/flatpak/"
FileUtils.install "#{CREW_DEST_PREFIX}/bin/flatpak", "#{CREW_DEST_PREFIX}/libexec/flatpak/flatpak", mode: 0o755
@flatpak_sh = <<~FLATPAK_HEREDOC
#!/bin/bash
# Flatpak needs to be able to see fonts in #{CREW_PREFIX}/share/fonts
if [ -L "~/.local/share/fonts" ] && [ ! -e "~/.local/share/fonts" ]; then
rm -f ~/.local/share/fonts
fi
if [ ! \\( -e ~/.local/share/fonts \\) ]; then
ln -s #{CREW_PREFIX}/share/fonts ~/.local/share/
fi
# Start pulseaudio if it is not running.
pgrep -x pulseaudio >/dev/null || pulseaudio -D
if [[ "\$*" == *run* ]]
then
FLATPAK_FLAGS='--socket=wayland'
else
FLATPAK_FLAGS='--user'
fi
unset GDK_PIXBUF_MODULE_FILE
unset GDK_PIXBUF_MODULEDIR
unset GDK_BACKEND
unset FONTCONFIG_PATH
#{CREW_PREFIX}/libexec/flatpak/flatpak \$FLATPAK_FLAGS "\$@"
FLATPAK_HEREDOC
IO.write("#{CREW_DEST_PREFIX}/bin/flatpak", @flatpak_sh, perm: 0o755)
FileUtils.mkdir_p "#{CREW_DEST_PREFIX}/share/dbus-1/system.d"
FileUtils.mv "#{CREW_DEST_PREFIX}/etc/dbus-1/system.d/org.freedesktop.Flatpak.SystemHelper.conf",
"#{CREW_DEST_PREFIX}/share/dbus-1/system.d/org.freedesktop.Flatpak.SystemHelper.conf"
FileUtils.mkdir_p "#{CREW_DEST_PREFIX}/etc/env.d/"
@env = <<~EOF
# Flatpak configuration
export XDG_DATA_DIRS='#{CREW_PREFIX}/share:#{CREW_PREFIX}/.config/.local/share/flatpak/exports/share:#{CREW_PREFIX}/var/lib/flatpak/exports/share'
EOF
IO.write("#{CREW_DEST_PREFIX}/etc/env.d/flatpak", @env)
end
def self.postinstall
system '[ -e /var/run/chrome/dconf ] || sudo mkdir /var/run/chrome/dconf'
system 'sudo chown chronos:chronos /var/run/chrome/dconf/ -Rv'
puts
puts 'Configuring flathub'.lightblue
system "#{CREW_PREFIX}/libexec/flatpak/flatpak remote-add --if-not-exists --user flathub https://flathub.org/repo/flathub.flatpakrepo"
puts
end
end