wok annotate memtest/receipt @ rev 25611

Add zx0
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Aug 01 18:37:27 2023 +0000 (15 months ago)
parents 5db546345599
children 54dc5622a785
rev   line source
pascal@524 1 # SliTaz package receipt.
pascal@524 2
pascal@524 3 PACKAGE="memtest"
pascal@25564 4 VERSION="6.20"
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@25508 12 WGET_URL="https://github.com/memtest86plus/memtest86plus/archive/refs/tags/v$VERSION.tar.gz"
pascal@524 13
pascal@25611 14 BUILD_DEPENDS="xz lz4 lzsa salvador gcc83"
pascal@13269 15
pascal@25463 16 # What is the latest version available today?
pascal@24071 17 current_version()
pascal@24071 18 {
pascal@25603 19 wget -O - ${WGET_URL%/arch*}/tags 2>/dev/null | \
pascal@25603 20 sed '/tag\//!d;s|.*tag/v*||;s|".*||;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@25611 33 for i in lzma lz4x2 lzsa1x2 lzsa2x2 zx0x2 ; 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@25504 40 sed -i "s|uncompress|un${i%x2}|" 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@25504 45 PACKER=${i%x2} ./pack $file $file.${i%x2}
pascal@25504 46 if [ $(stat -c %s $file.${i%x2}) -ge $((0x101F0)) ]; then
pascal@25504 47 rm $file.${i%x2}
pascal@25488 48 cp pack.bak pack
pascal@25504 49 sed -e "s|^#define FLAT16.*// lzma case|#define FLAT16 0 // ${i%x2}|" -i unpack.S
pascal@25488 50 asm unpack
pascal@25488 51 ./pack --build bootloader.bin unpack.bin
pascal@25504 52 PACKER=${i%x2} ./pack $file $file.${i%x2}
pascal@25487 53 fi
pascal@25504 54 mv unpack.lst unpack.lst.${i%x2}
pascal@25611 55 if [ "${i%x2}" != "$i" ]; then
pascal@25504 56 cp pack.bak pack
pascal@25504 57 sed -e "s|^#define DOUBLE_PACKED|#define DOUBLE_PACKED 1 // $i|" -i unpack.S
pascal@25504 58 asm unpack
pascal@25504 59 ./pack --build bootloader.bin unpack.bin
pascal@25504 60 PACKER=${i%x2} ./pack $file $file.$i
pascal@25504 61 mv unpack.lst unpack.lst.$i
pascal@25504 62 fi
pascal@24045 63 done
pascal@24045 64 }
pascal@24045 65
pascal@524 66 # Rules to configure and make the package.
pascal@524 67 compile_rules()
pascal@524 68 {
pascal@25511 69 sed -i 's|64, MT_VERSION "." GIT_HASH|65, MT_VERSION ".SliTaz"|;s|"\.x32"|".386"|' app/display.c
pascal@25511 70 sed 's|gcc|gcc-83|;s|march=i586|march=i486|' -i build32/Makefile
pascal@25511 71 patch -p0 < $stuff/memtest86\+-6-386.patch
pascal@25508 72 cd build32
pascal@25511 73 make boot/startup.o
pascal@25511 74 objdump -t boot/startup.o | \
pascal@25511 75 awk '/patch/ { print "sed -i \"s|" $5 "|0x" $1 "|\" ../boot/setup.S" }' | sh
pascal@25508 76 make memtest.bin
pascal@25564 77 tune_lzma memtest.bin 255,mf=bt2 LC 3 PB 2
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@25595 86 cp $src/LICENSE $install/usr/share/doc
pascal@25508 87 cp $src/build32/memtest.bin.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@25546 94 ! grep -qs 'Check 32 bits memory' $1/boot/isolinux/isolinux.cfg && sed -i \
pascal@20210 95 's|LABEL md5|LABEL memtest mem ram\
pascal@25546 96 MENU LABEL Check 32 bits memory\
pascal@25539 97 KERNEL /boot/memtest.exe\
pascal@20210 98 \n&|' $1/boot/isolinux/isolinux.cfg
pascal@20219 99 true
pascal@20210 100 }