Files
chromebrew/packages/cups.rb
2021-03-04 15:41:10 -06:00

103 lines
4.6 KiB
Ruby

require 'package'
class Cups < Package
description 'CUPS is the standards-based, open source printing system'
homepage 'https://github.com/OpenPrinting/cups'
@_ver = '2.3.3op2'
version @_ver
compatibility 'all'
source_url "https://github.com/OpenPrinting/cups/releases/download/v#{@_ver}/cups-#{@_ver}-source.tar.gz"
source_sha256 'deb3575bbe79c0ae963402787f265bfcf8d804a71fc2c94318a74efec86f96df'
binary_url({
aarch64: 'https://dl.bintray.com/chromebrew/chromebrew/cups-2.3.3op2-chromeos-armv7l.tar.xz',
armv7l: 'https://dl.bintray.com/chromebrew/chromebrew/cups-2.3.3op2-chromeos-armv7l.tar.xz',
i686: 'https://dl.bintray.com/chromebrew/chromebrew/cups-2.3.3op2-chromeos-i686.tar.xz',
x86_64: 'https://dl.bintray.com/chromebrew/chromebrew/cups-2.3.3op2-chromeos-x86_64.tar.xz'
})
binary_sha256({
aarch64: 'cf7fb54c659bb5f01c3097274864c3e0bf1669f0d6a8a1e6df82e6c403ad5264',
armv7l: 'cf7fb54c659bb5f01c3097274864c3e0bf1669f0d6a8a1e6df82e6c403ad5264',
i686: '74e029c12bf5af1545ca74ffddf0f70fda68bebaaab22c264d7541c2c7b570aa',
x86_64: '993136847f961e31b04906a36334278df723c12c5e55c7d7cf9ee797fad2ed88'
})
depends_on 'libusb'
depends_on 'linux_pam'
depends_on 'psmisc'
def self.build
system "env CFLAGS='-pipe -fno-stack-protector -U_FORTIFY_SOURCE -flto=auto' \
CXXFLAGS='-pipe -fno-stack-protector -U_FORTIFY_SOURCE -flto=auto' \
LDFLAGS='-fno-stack-protector -U_FORTIFY_SOURCE -flto=auto' \
./configure #{CREW_OPTIONS} \
--disable-launchd \
--disable-systemd \
--enable-libusb"
system 'make'
system "echo '#!/bin/bash' > startcupsd"
system "echo 'CUPSD=#{CREW_PREFIX}/sbin/cupsd' >> startcupsd"
system "echo 'CUPS=\$(pidof \$CUPSD 2> /dev/null)' >> startcupsd"
system "echo 'if [ -z \"\$CUPS\" ]; then' >> startcupsd"
system "echo ' \$CUPSD' >> startcupsd"
system "echo ' sleep 3' >> startcupsd"
system "echo 'fi' >> startcupsd"
system "echo 'CUPS=\$(pidof \$CUPSD 2> /dev/null)' >> startcupsd"
system "echo 'if [ ! -z \"\$CUPS\" ]; then' >> startcupsd"
system "echo ' echo \"cupsd process \$CUPS is running\"' >> startcupsd"
system "echo 'else' >> startcupsd"
system "echo ' echo \"cupsd failed to start\"' >> startcupsd"
system "echo ' exit 1' >> startcupsd"
system "echo 'fi' >> startcupsd"
system "echo '#!/bin/bash' > stopcupsd"
system "echo 'CUPSD=#{CREW_PREFIX}/sbin/cupsd' >> stopcupsd"
system "echo 'CUPS=\$(pidof \$CUPSD 2> /dev/null)' >> stopcupsd"
system "echo 'if [ ! -z \"\$CUPS\" ]; then' >> stopcupsd"
system "echo ' killall \$CUPSD' >> stopcupsd"
system "echo ' sleep 3' >> stopcupsd"
system "echo 'fi' >> stopcupsd"
system "echo 'CUPS=\$(pidof \$CUPSD 2> /dev/null)' >> stopcupsd"
system "echo 'if [ -z \"\$CUPS\" ]; then' >> stopcupsd"
system "echo ' echo \"cupsd process stopped\"' >> stopcupsd"
system "echo 'else' >> stopcupsd"
system "echo ' echo \"cupsd process \$CUPS is running\"' >> stopcupsd"
system "echo ' exit 1' >> stopcupsd"
system "echo 'fi' >> stopcupsd"
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_PREFIX}/share/man",
"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'
system "install -Dm755 startcupsd #{CREW_DEST_PREFIX}/bin/startcupsd"
system "install -Dm755 stopcupsd #{CREW_DEST_PREFIX}/bin/stopcupsd"
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
if 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
end
def self.postinstall
puts
puts "To start the cups daemon, run 'startcupsd'".lightblue
puts "To stop the cups daemon, run 'stopcupsd'".lightblue
puts
puts 'For more information, see https://docs.oracle.com/cd/E23824_01/html/821-1451/gllgm.html'.lightblue
puts
end
end