File debian.rules of Package system76-keyboard-configurator
#!/usr/bin/make -f
# -*- makefile -*-
# See:
# https://wiki.debian.org/Gnome/Rust_Packaging
# Uncomment this to turn on verbose mode.
export DH_VERBOSE=1
export DIR_WHERE_FIRST_CMAKELISTS_DOT_TEXT_IS=buildstartshere
# Get some information about the machine we are building on:
export numberOfProcessorsOnMachine=$(shell nproc)
export wantedJobs=$(shell echo "1.25*$(numberOfProcessorsOnMachine)" | bc -l)
export jobsIget=$(shell echo $(wantedJobs) | awk '{print int($$1+0.5)}')
export TOTAL_DISK = $(shell df -h --total | awk 'END{print $$2}')
export FREEMEM = $(shell free --mega)
export TOTAL_MEM = $(shell free --total --mega | xargs | awk '{print $$19"MB"}')
export TOTAL_RAM = $(shell free --total --mega | xargs | awk '{print $$8"MB"}')
export TOTAL_SWAP = $(shell free --total --mega | xargs | awk '{print $$15"MB"}')
export CARGO_NET_OFFLINE = true
# https://wiki.debian.org/Gnome/Rust_Packaging
include /usr/share/dpkg/pkg-info.mk
include /usr/share/dpkg/architecture.mk
include /usr/share/dpkg/buildflags.mk
include /usr/share/rustc/architecture.mk
export CFLAGS CXXFLAGS CPPFLAGS LDFLAGS
export DEB_HOST_RUST_TYPE DEB_HOST_GNU_TYPE
export PATH := /usr/share/cargo/bin:$(PATH)
export CARGO=/usr/share/cargo/bin/cargo
export CARGO_HOME=$(CURDIR)/debian/cargo_home
export DEB_CARGO_CRATE=$(DEB_SOURCE)_$(DEB_VERSION_UPSTREAM)
export DEB_BUILD_MAINT_OPTIONS=hardening=+bindnow
#export TITLE=System76-Keyboard-Configurator
#export executable=system76-keyboard-configurator
#export pkgname=system76-keyboard-configurator
#export pkgver=1.3.9
#export pkgrel=1
#export MAINTAINER=Kimi
#export MAINTAINEREMAIL=noreply@nodomain.org
export srcdir=/usr/src/packages/SOURCES
export pkgdir_head=/usr/src/packages/BUILD/debian
#export pkgdir=$(pkgdir_head)/$(pkgname)
export pkgdir=$(pkgdir_head)/tmp
export icon=$(pkgdir)/usr/share/icons/hicolor/scalable/apps/system76-keyboard-configurator.svg
%:
echo
echo "----- Entering section % -----"
echo
#find /usr/src/packages -maxdepth 3
echo
echo
echo
echo
#chmod +x /usr/src/packages/SOURCES/prepare_vendor.sh
#/usr/src/packages/SOURCES/prepare_vendor.sh
#tar -xf /usr/src/packages/SOURCES/vendor.tar.zst -C /usr/src/packages/BUILD
#mkdir -pv .cargo
#cp -v /usr/src/packages/SOURCES/cargo_config .cargo/config
#find /usr/src/packages -maxdepth 3
echo
echo
echo
echo
#dpkg-source --commit
dh $@ --buildsystem cargo
#dh $@
echo
echo "----- Exiting section % -----"
echo
override_dh_auto_clean:
#dh_auto_clean #removes vendor directory which we want to keep
rm -rf debian/cargo_registry
override_dh_auto_configure:
$(CARGO) prepare-debian debian/cargo_registry --link-from-system
rm -f Cargo.lock
#dh_auto_configure
override_dh_auto_build:
echo
echo "--- Start override_dh_auto_build: ---"
echo
echo "--- Machine data we are building on ---"
echo "Total disk: $$TOTAL_DISK"
echo "Output of free -h:"
echo "$$FREEMEM"
echo "Total memory: $$TOTAL_MEM"
echo "Total RAM: $$TOTAL_RAM"
echo "Total SWAP: $$TOTAL_SWAP"
echo "numberOfProcessorsOnMachine=$$numberOfProcessorsOnMachine"
echo "wantedJobs=$$wantedJobs"
echo "jobsIget=$$jobsIget"
echo "--- End machine data we are building on ---"
echo
echo "--- Show files ---"
#find /usr/src/packages
echo "--- End show files ---"
echo
#cargo vendor --no-delete --verbose --offline
#cargo update --verbose --offline
#cargo build --release --verbose --offline -j $(jobsIget)
#cargo build --release --verbose --offline --ignore-rust-version -Zavoid-dev-deps -Znamespaced-features -Zweak-dep-features
cargo build --release --verbose --offline -Zavoid-dev-deps -Znamespaced-features -Zweak-dep-features
echo "--- Show files ---"
#find /usr/src/packages/BUILD/target/release
#find /usr/src/packages/BUILD/debian
echo "--- End show files ---"
echo
echo "--- End override_dh_auto_build: ---"
echo
override_dh_auto_test:
override_dh_auto_install:
dh_auto_install
mv -v /usr/src/packages/BUILD/debian/system76-keyboard-configurator /usr/src/packages/BUILD/debian/tmp
install -dm755 "$(pkgdir)/usr/share/icons/hicolor/scalable/apps"
echo
cat <<EOF > "$(icon)"
echo "<svg width=\"256\" height=\"256\" viewBox=\"0 0 256 256\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">" > "$(icon)"
echo "<path d=\"M55 59C47.268 59 41 65.3494 41 73.1818V135C46.973 132.872 53.3041 131 60 131C95 131 117.435 147.636 118 192.714C118.114 201.831 114.361 208.5 110.861 215H225C232.732 215 239 208.651 239 200.818V73.1818C239 65.3494 232.732 59 225 59H55Z\" fill=\"#16393E\"/>" >> "$(icon)"
echo "<path d=\"M55 57C47.268 57 41 63.268 41 71V135.243C46.973 133.143 53.4006 132 60.0964 132C91.7365 132 117.386 157.52 117.386 189C117.386 196.798 115.83 204.231 112.98 211H225C232.732 211 239 204.732 239 197V71C239 63.268 232.732 57 225 57H55Z\" fill=\"#48B9C7\"/>" >> "$(icon)"
echo "<path d=\"M49.9012 147.043L48.9224 158.759C45.2145 160.135 41.7673 162.132 38.7278 164.666L28.0994 159.652L17.0003 175.085V178.913L26.6499 185.627C26.3063 187.573 26.1281 189.545 26.1172 191.522C26.1185 193.506 26.2883 195.486 26.625 197.441L17 200.31V204.131L28.0991 223.391L38.7029 218.39C41.7526 220.913 45.2084 222.898 48.9224 224.26L49.9012 236H72.0994L73.0776 224.285C76.7855 222.909 80.2332 220.911 83.2727 218.377L93.9009 223.391L105 204.131V200.31L95.3501 197.417C95.6937 195.47 95.8725 193.498 95.8833 191.522C95.8821 189.538 95.7117 187.557 95.375 185.602L105 178.913V175.087L93.9009 159.478L83.2977 164.654C80.248 162.131 76.7922 160.146 73.0781 158.783L72.0994 147.043H49.9012ZM61.0003 178.814C64.3645 178.814 67.5907 180.153 69.9695 182.536C72.3484 184.919 73.6851 188.151 73.6851 191.522C73.6851 194.892 72.3484 198.124 69.9695 200.508C67.5907 202.891 64.3645 204.23 61.0003 204.23C57.6361 204.23 54.4099 202.891 52.031 200.508C49.6522 198.124 48.3154 194.892 48.3154 191.522C48.3154 188.151 49.6522 184.919 52.031 182.536C54.4099 180.153 57.6361 178.814 61.0003 178.814Z\" fill=\"#966800\"/>" >> "$(icon)"
echo "<path d=\"M49.9012 143.217L48.9224 154.932C45.2145 156.308 41.7673 158.306 38.7278 160.84L28.0994 155.826L17.0003 175.087L26.6499 181.801C26.3063 183.747 26.1281 185.719 26.1172 187.696C26.1185 189.68 26.2883 191.66 26.625 193.615L17 200.304L28.0991 219.565L38.7029 214.564C41.7526 217.087 45.2084 219.072 48.9224 220.434L49.9012 232.174H72.0994L73.0776 220.458C76.7855 219.083 80.2332 217.085 83.2727 214.551L93.9009 219.565L105 200.304L95.3501 193.59C95.6937 191.644 95.8725 189.672 95.8833 187.696C95.8821 185.711 95.7117 183.731 95.375 181.776L105 175.087L93.9009 155.826L83.2977 160.827C80.248 158.304 76.7922 156.319 73.0781 154.957L72.0994 143.217H49.9012ZM61.0003 174.987C64.3645 174.987 67.5907 176.326 69.9695 178.71C72.3484 181.093 73.6851 184.325 73.6851 187.696C73.6851 191.066 72.3484 194.298 69.9695 196.681C67.5907 199.065 64.3645 200.404 61.0003 200.404C57.6361 200.404 54.4099 199.065 52.031 196.681C49.6522 194.298 48.3154 191.066 48.3154 187.696C48.3154 184.325 49.6522 181.093 52.031 178.71C54.4099 176.326 57.6361 174.987 61.0003 174.987V174.987Z\" fill=\"#F7E062\"/>" >> "$(icon)"
echo "<rect x=\"66\" y=\"83\" width=\"28\" height=\"28\" rx=\"4\" fill=\"#16393E\"/>" >> "$(icon)"
echo "<rect x=\"106\" y=\"83\" width=\"28\" height=\"28\" rx=\"4\" fill=\"#16393E\"/>" >> "$(icon)"
echo "<rect x=\"106\" y=\"123\" width=\"28\" height=\"28\" rx=\"4\" fill=\"#16393E\"/>" >> "$(icon)"
echo "<rect x=\"146\" y=\"83\" width=\"28\" height=\"28\" rx=\"4\" fill=\"#16393E\"/>" >> "$(icon)"
echo "<rect x=\"146\" y=\"123\" width=\"28\" height=\"28\" rx=\"4\" fill=\"#16393E\"/>" >> "$(icon)"
echo "<rect x=\"185\" y=\"83\" width=\"28\" height=\"28\" rx=\"4\" fill=\"#16393E\"/>" >> "$(icon)"
echo "<rect x=\"185\" y=\"123\" width=\"28\" height=\"28\" rx=\"4\" fill=\"#16393E\"/>" >> "$(icon)"
echo "<rect x=\"66\" y=\"81\" width=\"28\" height=\"28\" rx=\"4\" fill=\"white\"/>" >> "$(icon)"
echo "<rect x=\"106\" y=\"81\" width=\"28\" height=\"28\" rx=\"4\" fill=\"white\"/>" >> "$(icon)"
echo "<rect x=\"106\" y=\"121\" width=\"28\" height=\"28\" rx=\"4\" fill=\"white\"/>" >> "$(icon)"
echo "<rect x=\"146\" y=\"81\" width=\"28\" height=\"28\" rx=\"4\" fill=\"#F7E062\"/>" >> "$(icon)"
echo "<rect x=\"146\" y=\"121\" width=\"28\" height=\"28\" rx=\"4\" fill=\"white\"/>" >> "$(icon)"
echo "<rect x=\"185\" y=\"81\" width=\"28\" height=\"28\" rx=\"4\" fill=\"white\"/>" >> "$(icon)"
echo "<rect x=\"185\" y=\"121\" width=\"28\" height=\"28\" rx=\"4\" fill=\"#F7E062\"/>" >> "$(icon)"
echo "<path d=\"M117.351 191C117.374 190.336 117.386 189.669 117.386 189C117.386 179.634 115.115 170.796 111.092 163H181C183.209 163 185 164.791 185 167V187C185 189.209 183.209 191 181 191H117.351Z\" fill=\"#16393E\"/>" >> "$(icon)"
echo "<path d=\"M117.386 189H181C183.209 189 185 187.209 185 185V165C185 162.791 183.209 161 181 161H110.009C114.705 169.27 117.386 178.824 117.386 189Z\" fill=\"white\"/>" >> "$(icon)"
echo "<path d=\"M70 121C67.7909 121 66 122.791 66 125V132.299C76.4121 133.359 85.9984 137.194 94 143.048V125C94 122.791 92.2091 121 90 121H70Z\" fill=\"white\"/>" >> "$(icon)"
echo "</svg>" >> "$(icon)"
#
install -Dm644 "$(srcdir)/launcher.desktop" "$(pkgdir)/usr/share/applications/system76-keyboard-configurator.desktop"
#
echo "--- Show files ---"
#find /usr/src/packages/BUILD/debian/tmp
find $(pkgdir)
echo "--- End show files ---"