summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan-Henrik Bruhn2020-11-14 13:00:43 +0100
committerJan-Henrik Bruhn2020-11-14 13:00:43 +0100
commit0ab0f694ff8d68eddcad9b3204485412e1d109dd (patch)
treef8210382fd9e6c851aca19c2c2063aab3c90adf1
parent5db7b0a43e5d14b9ea5078ce2034ec6c6b3ae0d3 (diff)
downloadaur-0ab0f694ff8d68eddcad9b3204485412e1d109dd.tar.gz
Switch to new Build procedure using the Update path of LTSpice.
-rw-r--r--.SRCINFO13
-rw-r--r--PKGBUILD117
-rw-r--r--ltspice.sh8
3 files changed, 122 insertions, 16 deletions
diff --git a/.SRCINFO b/.SRCINFO
index e7bbd4d8e3f7..c8642654a93c 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,17 +1,20 @@
pkgbase = ltspice
- pkgdesc = SPICE simulator, schematic capture and waveform viewer of electronic circuits.
- pkgver = 17.0.18.0
+ pkgdesc = SPICE simulator, schematic capture and waveform viewer. Installation based on Field Update Utility.
+ pkgver = 17.20201112.2
pkgrel = 1
url = http://www.linear.com/designtools/software/
arch = x86_64
license = custom
makedepends = git
+ makedepends = curl
+ makedepends = gzip
+ makedepends = sed
+ makedepends = awk
+ makedepends = cksfv
depends = wine
- source = ltspice::git+https://github.com/jhbruhn/ltspice#branch=17.0.18.0
source = ltspice.sh
source = ltspice-help.sh
- sha256sums = SKIP
- sha256sums = 7556a06775c73e4aaa48e200803baad6310c1dfc150d86a40b197f0ab8eaf11c
+ sha256sums = 2a2a222c0264af58913d629d58513ead7230861bbed8638f863e48d4ebfe295a
sha256sums = 04fb3968b8572d02a69ee61590c038a9560809160b4c6260ded5f802e9ef859a
pkgname = ltspice
diff --git a/PKGBUILD b/PKGBUILD
index 5cf1a25d0c69..860d6a200cb5 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,21 +1,113 @@
# Maintainer: Jan-Henrik Bruhn <aur@jhbruhn.de>
-# Maintainer: Max Stabel <max dot stabel03 at gmail dot com>
+# Contributor: Max Stabel <max dot stabel03 at gmail dot com>
+
+_ltspice_ver_roman="XVII"
+_ltspice_ver="17"
pkgname=ltspice
-pkgver=17.0.18.0
+pkgver=17.20201112.2
pkgrel=1
-pkgdesc="SPICE simulator, schematic capture and waveform viewer of electronic circuits."
+pkgdesc="SPICE simulator, schematic capture and waveform viewer. Installation based on Field Update Utility."
arch=('x86_64')
url="http://www.linear.com/designtools/software/"
license=('custom')
depends=('wine')
-makedepends=('git')
-source=("$pkgname::git+https://github.com/jhbruhn/$pkgname#branch=${pkgver//_/-}"
- "$pkgname.sh"
+makedepends=('git' 'curl' 'gzip' 'sed' 'awk' 'cksfv')
+_update_url="https://ltspice.analog.com/fieldsync$_ltspice_ver_roman"
+
+source=("$pkgname.sh"
"$pkgname-help.sh")
-sha256sums=('SKIP'
- '7556a06775c73e4aaa48e200803baad6310c1dfc150d86a40b197f0ab8eaf11c'
+sha256sums=('2a2a222c0264af58913d629d58513ead7230861bbed8638f863e48d4ebfe295a'
'04fb3968b8572d02a69ee61590c038a9560809160b4c6260ded5f802e9ef859a')
+_curl_opts="-s --connect-timeout 5 --max-time 10 --retry 3 --retry-delay 0 --retry-max-time 40"
+
+_download_file() {
+ file=$1
+ crc=$2
+
+ _download=true
+ # check whether cached file with correct CRC exists
+ if [ -f "$pkgname/$file" ]; then
+ f_crc=$(cksfv -c "$pkgname/$file" | sed '/^;/d' | awk '{print $2}')
+ if [ "$crc" = "$f_crc" ]; then
+ _download=false
+ fi
+ fi
+
+ if [ "$_download" = true ]; then
+ echo "Download $file"
+ mkdir -p "${pkgname}/$(dirname $file)"
+
+ # first try compressed path and decompress
+ compressed_found=false
+ url="${_update_url}${file}.gz"
+ compressed="${pkgname}/${file}.gz"
+ curl -f $_curl_opts $url -o $compressed || true
+ if [ -f "$compressed" ]; then
+ cat $compressed | gunzip > $pkgname/$file
+ rm $compressed
+ compressed_found=true
+ fi
+ # download uncompressed file if compressed was not found
+ if [ "$compressed_found" = false ]; then
+ url="${_update_url}${file}"
+ curl $_curl_opts $url -o "$pkgname/$file"
+ fi
+ fi
+
+}
+
+# initialize a semaphore with a given number of tokens
+open_sem(){
+ mkfifo pipe-$$
+ exec 3<>pipe-$$
+ rm pipe-$$
+ local i=$1
+ for((;i>0;i--)); do
+ printf %s 000 >&3
+ done
+}
+
+# run the given command asynchronously and pop/push tokens
+run_with_lock(){
+ local x
+ # this read waits until there is something to read
+ read -u 3 -n 3 x && ((0==x)) || exit $x
+ (
+ ( "$@"; )
+ # push the return code of the command to the semaphore
+ printf '%.3d' $? >&3
+ )&
+}
+
+prepare() {
+ mkdir -p $pkgname
+
+
+ _download_file "/Changelog.txt" ""
+}
+
+N=$(($(nproc) * 4))
+open_sem $N
+build() {
+ release_logs="$_update_url/release.log.gz"
+
+ curl "$release_logs" | gunzip > ./release.log
+
+ echo "Checking cache and downloading using $N threads."
+ for entry in $(cat release.log | sed '/^#/d' | awk '{print $6"/"$8}')
+ do
+ file=$(echo $entry | awk -F/ '{print $2}' | sed 's/\\/\//g' | tr -d '\n\r')
+ file="${file:1}"
+ crc=$(echo $entry | awk -F/ '{print $1}')
+ # download files from list, checking the CRC (something is still wrong with the CRC it seems)
+ run_with_lock _download_file "$file" "$crc"
+ done
+
+ wait
+
+ echo "Downloaded files."
+}
package()
{
@@ -23,7 +115,6 @@ package()
# Install License
install -Dm644 License.txt "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
- rm License.txt
# Install docs to /usr/share/doc/
install -Dm644 LTspiceHelp.chm "${pkgdir}/usr/share/doc/${pkgname}/ltspice.chm"
@@ -37,3 +128,11 @@ package()
install -Dm755 "$srcdir/$pkgname.sh" "$pkgdir/usr/bin/$pkgname"
install -Dm755 "$srcdir/$pkgname-help.sh" "$pkgdir/usr/bin/$pkgname-help"
}
+
+pkgver() {
+ cd "$pkgname"
+ date=$(cat Changelog.txt | head -n1 | awk '{print $1}')
+ count=$(grep -c "$date" Changelog.txt)
+ date_format=$(echo $date | awk -F/ '{print "20"$3$1$2}')
+ echo "$_ltspice_ver.$date_format.$count"
+}
diff --git a/ltspice.sh b/ltspice.sh
index 09232a47e832..561493612403 100644
--- a/ltspice.sh
+++ b/ltspice.sh
@@ -1,7 +1,11 @@
#!/bin/sh
+CONFIG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/ltspice"
if [ ! -d "$HOME"/.ltspice ] ; then
mkdir -p "$HOME"/.ltspice
- touch "$HOME"/.ltspice/LTspiceXVII.ini
+fi
+if [ ! -d $CONFIG_DIR ]; then
+ mkdir -p $CONFIG_DIR
+ touch $CONFIG_DIR/LTspiceXVII.ini
fi
export WINEPREFIX=$HOME/.ltspice/env
-wine /usr/share/ltspice/XVIIx64 -ini "$HOME"/.ltspice/LTspiceXVII.ini "$@"
+wine /usr/share/ltspice/XVIIx64 -ini $CONFIG_DIR/LTspiceXVII.ini "$@"