Files
chromebrew/packages/cups.rb
Maximilian Downey Twiss f6b6cab229 Rename autotools constants to fall in line with the rest of crew (#10442)
* Rename CREW_OPTIONS to CREW_CONFIGURE_OPTIONS

* Rename build_extras and install_extras to configure_build_extras and configure_install_extras
2024-09-09 18:21:58 -05:00

109 lines
3.5 KiB
Ruby

require 'package'
class Cups < Package
description 'CUPS is the standards-based, open source printing system'
homepage 'https://github.com/OpenPrinting/cups'
version '2.4.10'
compatibility 'all'
license 'Apache-2.0'
source_url 'https://github.com/OpenPrinting/cups.git'
git_hashtag "v#{version}"
binary_compression 'tar.zst'
binary_sha256({
aarch64: 'ecc709a871b29edcb2cf0fba701bb0d47f27ecf0d9f951d9bc562a4e3e56af5c',
armv7l: 'ecc709a871b29edcb2cf0fba701bb0d47f27ecf0d9f951d9bc562a4e3e56af5c',
i686: '6a24d83dd8bae75bffab5a6a9ac36b6d2d1087ae134b3e1eb41043f4dffbc4b9',
x86_64: 'd809d075fdfbe30f9b722ae597204c1e12f0b72b1c674fcdb17e59a098606cb7'
})
depends_on 'acl' # R
depends_on 'gcc_lib' # R
depends_on 'glibc' # R
depends_on 'libusb' # R
depends_on 'linux_pam' # R
depends_on 'llvm18_dev' => :build if %w[armv7l aarch64].include?(ARCH)
depends_on 'openssl' # R
depends_on 'psmisc' # L
depends_on 'zlib' # R
no_env_options
no_fhs
def self.build
@buildoverride = %w[armv7l aarch64].include?(ARCH) ? 'CC=clang CXX=clang++ LD=mold CUPS_LINKER=mold' : ''
system "#{@buildoverride} ./configure #{CREW_CONFIGURE_OPTIONS} \
--enable-libusb"
system 'make'
File.write 'startcupsd', <<~EOF
#!/bin/bash
CUPSD=#{CREW_PREFIX}/sbin/cupsd
CUPS=$(pidof "$CUPSD" 2> /dev/null)
if [ -z "$CUPS" ]; then
$CUPSD
sleep 3
fi
CUPS=$(pidof "$CUPSD" 2> /dev/null)
if [ -n "$CUPS" ]; then
echo "cupsd process $CUPS is running"
else
echo "cupsd failed to start"
exit 1
fi
EOF
File.write 'stopcupsd', <<~EOF
#!/bin/bash
CUPSD=#{CREW_PREFIX}/sbin/cupsd
CUPS=$(pidof "$CUPSD" 2> /dev/null)
if [ -n "$CUPS" ]; then
killall "$CUPSD"
sleep 3
fi
CUPS=$(pidof "$CUPSD" 2> /dev/null)
if [ -z "$CUPS" ]; then
echo "cupsd process stopped"
else
echo "cupsd process $CUPS is running"
exit 1
fi
EOF
end
def self.install
system 'make',
"DESTDIR=#{CREW_DEST_DIR}",
"DATADIR=#{CREW_DEST_PREFIX}/share/cups",
"DOCDIR=#{CREW_DEST_PREFIX}/share/doc/cups",
"MANDIR=#{CREW_DEST_MAN_PREFIX}",
"ICONDIR=#{CREW_PREFIX}/share/icons",
"MENUDIR=#{CREW_PREFIX}/share/applications",
"INITDIR=#{CREW_PREFIX}/etc/init.d",
"SERVERROOT=#{CREW_DEST_PREFIX}/etc/cups",
"SERVERBIN=#{CREW_DEST_PREFIX}/libexec/cups",
"CACHEDIR=#{CREW_DEST_PREFIX}/var/cache/cups",
"LOCALEDIR=#{CREW_DEST_PREFIX}/share/locale",
'install'
FileUtils.mkdir_p "#{CREW_DEST_PREFIX}/bin"
FileUtils.install 'startcupsd', "#{CREW_DEST_PREFIX}/bin/startcupsd", mode: 0o755
FileUtils.install 'stopcupsd', "#{CREW_DEST_PREFIX}/bin/stopcupsd", mode: 0o755
if File.exist?("#{CREW_DEST_DIR}/etc/dbus-1/system.d/cups.conf")
FileUtils.mkdir_p "#{CREW_DEST_PREFIX}/share/dbus-1/system.d"
FileUtils.mv "#{CREW_DEST_DIR}/etc/dbus-1/system.d/cups.conf", "#{CREW_DEST_PREFIX}/share/dbus-1/system.d/"
end
return unless File.exist?("#{CREW_DEST_DIR}/etc/pam.d/cups")
FileUtils.mkdir_p "#{CREW_DEST_PREFIX}/etc/pam.d"
FileUtils.mv "#{CREW_DEST_DIR}/etc/pam.d/cups", "#{CREW_DEST_PREFIX}/etc/pam.d/"
end
def self.postinstall
ExitMessage.add <<~EOM.lightblue
To start the cups daemon, run 'startcupsd'
To stop the cups daemon, run 'stopcupsd'
For more information, see https://www.cups.org/doc/admin.html.
EOM
end
end