wok annotate memtest/receipt @ rev 25491

Up foomatic-db-nonfree (20221116)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Nov 17 12:13:24 2022 +0000 (24 months ago)
parents 742d338c8574
children 7f7bd3c9775e
rev   line source
pascal@524 1 # SliTaz package receipt.
pascal@524 2
pascal@524 3 PACKAGE="memtest"
pascal@15468 4 VERSION="5.01"
pascal@524 5 CATEGORY="base-system"
pascal@524 6 SHORT_DESC="Memory failures detection tool."
pascal@524 7 MAINTAINER="pascal.bellard@slitaz.org"
pascal@17225 8 LICENSE="GPL2"
pascal@1734 9 SOURCE="memtest86+"
pascal@1734 10 TARBALL="$SOURCE-$VERSION.tar.gz"
pascal@24991 11 WEB_SITE="https://www.memtest.org/"
pascal@25049 12 WGET_URL="${WEB_SITE}download/archives/$VERSION/$TARBALL"
pascal@524 13
pascal@25487 14 BUILD_DEPENDS="xz lz4 lzsa"
pascal@13269 15
pascal@25463 16 # What is the latest version available today?
pascal@24071 17 current_version()
pascal@24071 18 {
pascal@24071 19 wget -O - $WEB_SITE 2>/dev/null | \
pascal@24071 20 sed '/tar.gz"/!d;s|.*memtest86.-||;s|.tar.*||;q'
pascal@24071 21 }
pascal@24071 22
pascal@25487 23 asm()
pascal@25487 24 {
pascal@25487 25 cc -o $1.o -Wa,-a=$1.lst -c $1.S
pascal@25487 26 objcopy --only-section=.text -O binary $1.o $1.bin
pascal@25487 27 }
pascal@25487 28
pascal@24045 29 tune_lzma()
pascal@24045 30 {
pascal@25487 31 file=$1
pascal@25487 32 shift
pascal@25491 33 for i in lzma lz4 lzsa1 lzsa2 ; do
pascal@25488 34 cp $stuff/*.S $stuff/pack .
pascal@25488 35 sed "s/VERSION/$VERSION/;s|lzma1=|&nice=${1:-64},|" -i pack
pascal@25487 36 while [ -n "$2" ]; do
pascal@25487 37 sed "s|^#define PROP_$2 .*|#define PROP_$2 $3|" -i unlzma.S
pascal@25487 38 shift 2
pascal@25487 39 done
pascal@25488 40 sed -i "s|uncompress|un$i|" unpack.S
pascal@25487 41 asm bootloader
pascal@25488 42 asm unpack
pascal@25488 43 cp pack pack.bak
pascal@25488 44 ./pack --build bootloader.bin unpack.bin
pascal@25488 45 PACKER=$i ./pack $file $file.$i
pascal@25487 46 if [ $(stat -c %s $file.$i) -ge $((0x101F0)) ]; then
pascal@25487 47 rm $file.$i
pascal@25488 48 cp pack.bak pack
pascal@25488 49 sed -e "s|^#define FLAT16.*// lzma case|#define FLAT16 0 // $i|" -i unpack.S
pascal@25488 50 asm unpack
pascal@25488 51 ./pack --build bootloader.bin unpack.bin
pascal@25488 52 PACKER=$i ./pack $file $file.$i
pascal@25487 53 fi
pascal@25491 54 mv unpack.lst unpack.lst.$i
pascal@24045 55 done
pascal@24045 56 }
pascal@24045 57
pascal@524 58 # Rules to configure and make the package.
pascal@524 59 compile_rules()
pascal@524 60 {
pascal@24941 61 # binutils 2.37 support
pascal@24941 62 sed -i 's|\t}|&\n\t/DISCARD/ : { *(*) }|' memtest.bin.lds
pascal@24941 63
pascal@24043 64 ls $stuff/memtest*-$VERSION-*.patch &&
pascal@24043 65 for i in $stuff/memtest*-$VERSION-*.patch ; do
pascal@24043 66 patch -p1 < $i
pascal@17225 67 done
pascal@1734 68 make
pascal@17227 69 mv memtest.bin memtest.bin.console
pascal@25487 70 tune_lzma memtest.bin.console 218,mf=bt2 LC 2
pascal@14796 71 sed -i -e 's/SERIAL_CONSOLE_DEFAULT 0/SERIAL_CONSOLE_DEFAULT 1/' \
pascal@14796 72 -e 's/SERIAL_BAUD_RATE 9600/SERIAL_BAUD_RATE 115200/' config.h
pascal@14796 73 make clean
pascal@14796 74 make
pascal@17227 75 mv memtest.bin memtest.bin.serial
pascal@25487 76 tune_lzma memtest.bin.serial 179,mf=bt3 LC 2
pascal@25487 77 cp memtest.bin.serial.lzma memtest.packed-115200
pascal@524 78 }
pascal@524 79
pascal@524 80
pascal@524 81 # Rules to gen a SliTaz package suitable for Tazpkg.
pascal@524 82 genpkg_rules()
pascal@524 83 {
pascal@20042 84 mkdir -p $fs/boot $install/usr/share/doc
pascal@20042 85 cp $src/README* $install/usr/share/doc
pascal@20042 86 cp $src/FAQ $install/usr/share/doc
pascal@25487 87 cp $src/memtest.bin.console.lzma $fs/boot/memtest.exe
pascal@524 88 }
pascal@20210 89
pascal@20210 90 # Pre and post install commands for Tazpkg.
pascal@20210 91 post_install()
pascal@20210 92 {
pascal@20210 93 [ -s $1/boot/isolinux/isolinux.cfg ] &&
pascal@20210 94 ! grep -qs 'Check memory' $1/boot/isolinux/isolinux.cfg && sed -i \
pascal@20210 95 's|LABEL md5|LABEL memtest mem ram\
pascal@20210 96 MENU LABEL Check memory\
pascal@20210 97 KERNEL /boot/memtest.exe\
pascal@20210 98 \n&|' $1/boot/isolinux/isolinux.cfg
pascal@20219 99 true
pascal@20210 100 }