summaryrefslogtreecommitdiffstats
path: root/system/system76-power/system76-power.SlackBuild
diff options
context:
space:
mode:
Diffstat (limited to 'system/system76-power/system76-power.SlackBuild')
-rw-r--r--system/system76-power/system76-power.SlackBuild179
1 files changed, 75 insertions, 104 deletions
diff --git a/system/system76-power/system76-power.SlackBuild b/system/system76-power/system76-power.SlackBuild
index 4eafea3ea1..ba3303aa2f 100644
--- a/system/system76-power/system76-power.SlackBuild
+++ b/system/system76-power/system76-power.SlackBuild
@@ -1,8 +1,8 @@
-#!/bin/sh
+#!/bin/bash
# Slackware build script for system76-power
-# Copyright 2019-2020 Erich Ritz, Scottsdale, Arizona, USA
+# Copyright 2019-2024 Erich Ritz, Jenks, Oklahoma, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -22,10 +22,22 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+# 20220210 bkw: Warning from SlackBuilds.org: the download URLs are
+# incorrect. They work OK when using a client that doesn't respect the
+# Content-disposition header (e.g. wget in its default config), but
+# they'll break with clients that do respect it.
+#
+# 20220301 etr: Fix script to work with Content-disposition-safe download URL.
+# Bit hackish, but it works.
+
+cd $(dirname $0) ; CWD=$(pwd)
+
PRGNAM=system76-power
-VERSION=${VERSION:-1.1.11}
-BUILD=${BUILD:-1}
+VERSION=${VERSION:-1.1.25_fc8eb49}
+SRCVER=${SRCVER:-fc8eb49fae5222da56dcfa414ef2b190e9f870c7}
+BUILD=${BUILD:-2}
TAG=${TAG:-_SBo}
+PKGTYPE=${PKGTYPE:-tgz}
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
@@ -33,15 +45,19 @@ if [ -z "$ARCH" ]; then
arm*) ARCH=arm ;;
*) ARCH=$( uname -m ) ;;
esac
+fi
- if [ "$ARCH" = "i586" ]; then
- if rustc -Vv | grep host | grep i686 > /dev/null ; then
- ARCH=i686
- fi
- fi
+case "$ARCH" in
+ x86_64) ;;
+ arm*) ;;
+ *) echo "Unsupported ARCH '$ARCH'"; exit 1 ;;
+esac
+
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
+ exit 0
fi
-CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
@@ -65,111 +81,63 @@ set -e
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
-rm -rf $PRGNAM-$VERSION
-if [ -e $CWD/$VERSION.tar.gz ]; then
- tar xvf $CWD/$VERSION.tar.gz
-else
- tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
-fi
-cd $PRGNAM-$VERSION
+rm -rf $PRGNAM-$SRCVER
+tar xvf $CWD/$PRGNAM-$SRCVER.tar.gz
+cd $PRGNAM-$SRCVER
# build offline
# configuration tells cargo to use the configured directory
# for dependencies intead of downloading from crates.io
mkdir .cargo
-cat << EOF >> .cargo/config
+cat << EOF >> .cargo/config.toml
+[source]
[source.crates-io]
replace-with = "vendored-sources"
[source."https://github.com/pop-os/sysfs-class"]
git = "https://github.com/pop-os/sysfs-class"
-branch = "master"
replace-with = "vendored-sources"
[source.vendored-sources]
-directory = "$(pwd)/vendor"
+directory = "vendor"
EOF
-mkdir vendor
# deps and versions come from Cargo.lock
+mkdir vendor
(
cd vendor
- for dependency in \
- ansi_term=0.11.0 \
- atty=0.2.14 \
- autocfg=1.0.1 \
- bitflags=1.2.1 \
- bytes=0.5.6 \
- cc=1.0.59 \
- cfg-if=0.1.10 \
- chrono=0.4.15 \
- clap=2.33.3 \
- dbus=0.8.4 \
- err-derive=0.2.4 \
- fern=0.6.0 \
- fuchsia-zircon=0.3.3 \
- fuchsia-zircon-sys=0.3.3 \
- futures-core=0.3.5 \
- hermit-abi=0.1.15 \
- hidapi=1.2.3 \
- inotify=0.8.3 \
- inotify-sys=0.1.3 \
- intel-pstate=0.2.1 \
- iovec=0.1.4 \
- kernel32-sys=0.2.2 \
- lazy_static=1.4.0 \
- libc=0.2.76 \
- libdbus-sys=0.2.1 \
- log=0.4.11 \
- mio=0.6.22 \
- miow=0.2.1 \
- net2=0.2.34 \
- num-integer=0.1.43 \
- num-traits=0.2.12 \
- numtoa=0.2.3 \
- pin-project-lite=0.1.7 \
- pkg-config=0.3.18 \
- proc-macro-error=1.0.4 \
- proc-macro-error-attr=1.0.4 \
- proc-macro2=1.0.19 \
- quote=1.0.7 \
- rustversion=1.0.3 \
- slab=0.4.2 \
- smart-default=0.6.0 \
- strsim=0.8.0 \
- syn=1.0.39 \
- synstructure=0.12.4 \
- sysfs-class=0.1.3 \
- textwrap=0.11.0 \
- time=0.1.44 \
- tokio=0.2.22 \
- unicode-width=0.1.8 \
- unicode-xid=0.2.1 \
- vec_map=0.8.2 \
- vergen=3.1.0 \
- version_check=0.9.2 \
- wasi=0.10.0+wasi-snapshot-preview1 \
- winapi=0.2.8 \
- winapi=0.3.9 \
- winapi-build=0.1.1 \
- winapi-i686-pc-windows-gnu=0.4.0 \
- winapi-x86_64-pc-windows-gnu=0.4.0 \
- ws2_32-sys=0.2.1; do
-
- dep="$(echo "$dependency" | cut -d= -f1)"
- ver="$(echo "$dependency" | cut -d= -f2)"
-
- if [ -e $CWD/$dep-$ver.crate ]; then
- CRATE_FILE=$CWD/$dep-$ver.crate
+ grep -h -A 4 "\[\[package\]\]" \
+ $(find "../" -maxdepth 1 -mindepth 1 -name Cargo.lock | tr '\n' ' ') | \
+ sed 's/[[:space:]]*=[[:space:]]*/=/g;s/^--//;s/^\[\[/--\n[[/' | \
+ awk 'BEGIN { RS = "--\n" ; FS="\n" } { print $2, $3, $4, $5 }' | \
+ sed 's/"//g;s/name=//;s/ version=/=/' | \
+ grep " source=" | \
+ sed 's/ dependencies=.*$//' | \
+ sed 's/ source=[^ ]*//' | \
+ sed 's/ checksum=/=/' | \
+ sort -u | \
+ while read -r dep ; do
+
+ cksum="$(printf "%s\n" "$dep" | cut -d= -f3)"
+ ver="$(printf "%s\n" "$dep" | cut -d= -f2)"
+ dep="$(printf "%s\n" "$dep" | cut -d= -f1)"
+
+ CRATE_FILE=$CWD/$dep-$ver.crate
+
+ if [ -z "$cksum" ] ; then
+ if [ "$dep" = "sysfs-class" ] ; then
+ CRATE_FILE=$CWD/pop-os-sysfs-class-0.1.3-1-gab63e7f.tar.gz
+ fi
+ mkdir $dep-$ver
+ if [ "$dep" = "sysfs-class" ] ; then
+ CRATE_FILE=$CWD/pop-os-$dep-$ver-1-gab63e7f.tar.gz
+ fi
+ tar xvf $CRATE_FILE -C $dep-$ver --strip-components=1
+ cksum="null"
else
- if [ -e $CWD/$ver.tar.gz ]; then
- CRATE_FILE=$CWD/$ver.tar.gz
- else
- CRATE_FILE=$CWD/$dep-$ver.tar.gz
- fi
+ tar xvf $CRATE_FILE
fi
- tar xvf $CRATE_FILE
touch $dep-$ver/.cargo-ok
@@ -184,16 +152,10 @@ mkdir vendor
) | sed '$ s/,$//'
printf " },\n"
- printf ' "package": "'
-
- sha256sum "$CRATE_FILE" | cut -f1 -d' ' | sed 's/$/"/'
+ printf ' "package": "%s"' "$cksum"
printf "}\n"
- } | python -c "import sys, json; data = sys.stdin.read(); print json.dumps(json.loads(data), sort_keys=True, indent=4, separators=(',', ' : '))" > $dep-$ver/.cargo-checksum.json
- # Change selected package checksums to null
- if [ "$dep" == "sysfs-class" ] ; then
- sed -i 's/"package" : ".\{64\}"/"package" : null/' $dep-$ver/.cargo-checksum.json
- fi
+ } | python3 -c "import sys, json; data = sys.stdin.read(); print (json.dumps(json.loads(data), sort_keys=True, indent=4, separators=(',', ' : ')))" > $dep-$ver/.cargo-checksum.json
done
)
@@ -204,15 +166,24 @@ find -L . \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
+# Prevent syslog messasge 'Unknown group "sudo" in message bus configuration file'.
+patch -p1 < $CWD/fix_groups.patch
+# Prevent CPU from overheating
+patch -p1 < $CWD/xeon_fan_curve.patch
+# Prevent NVMe U.2 SSD from overheating
+patch -p1 < $CWD/nvme_temp.patch
+
+export CARGO_HOME=.cargo
+
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
-libdir=/usr/lib${LIBDIRSUFFIX} \
make
make install DESTDIR=$PKG
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
+rm -rf $PKG/usr/lib
mkdir -p $PKG/etc/logrotate.d $PKG/etc/rc.d
install -m 0644 $CWD/config/system76-power.logrotate $PKG/etc/logrotate.d/system76-power.new
install -m 0644 $CWD/config/rc.system76-power $PKG/etc/rc.d/rc.system76-power.new
@@ -226,4 +197,4 @@ cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh
cd $PKG
-/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE