wok view memtest/receipt @ rev 25656

Up fwknop (2.6.11)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Feb 09 11:08:06 2024 +0000 (5 months ago)
parents 5db546345599
children
line source
1 # SliTaz package receipt.
3 PACKAGE="memtest"
4 VERSION="6.20"
5 CATEGORY="base-system"
6 SHORT_DESC="Memory failures detection tool."
7 MAINTAINER="pascal.bellard@slitaz.org"
8 LICENSE="GPL2"
9 SOURCE="memtest86+"
10 TARBALL="$SOURCE-$VERSION.tar.gz"
11 WEB_SITE="https://www.memtest.org/"
12 WGET_URL="https://github.com/memtest86plus/memtest86plus/archive/refs/tags/v$VERSION.tar.gz"
14 BUILD_DEPENDS="xz lz4 lzsa salvador gcc83"
16 # What is the latest version available today?
17 current_version()
18 {
19 wget -O - ${WGET_URL%/arch*}/tags 2>/dev/null | \
20 sed '/tag\//!d;s|.*tag/v*||;s|".*||;q'
21 }
23 asm()
24 {
25 cc -o $1.o -Wa,-a=$1.lst -c $1.S
26 objcopy --only-section=.text -O binary $1.o $1.bin
27 }
29 tune_lzma()
30 {
31 file=$1
32 shift
33 for i in lzma lz4x2 lzsa1x2 lzsa2x2 zx0x2 ; do
34 cp $stuff/*.S $stuff/pack .
35 sed "s/VERSION/$VERSION/;s|lzma1=|&nice=${1:-64},|" -i pack
36 while [ -n "$2" ]; do
37 sed "s|^#define PROP_$2 .*|#define PROP_$2 $3|" -i unlzma.S
38 shift 2
39 done
40 sed -i "s|uncompress|un${i%x2}|" unpack.S
41 asm bootloader
42 asm unpack
43 cp pack pack.bak
44 ./pack --build bootloader.bin unpack.bin
45 PACKER=${i%x2} ./pack $file $file.${i%x2}
46 if [ $(stat -c %s $file.${i%x2}) -ge $((0x101F0)) ]; then
47 rm $file.${i%x2}
48 cp pack.bak pack
49 sed -e "s|^#define FLAT16.*// lzma case|#define FLAT16 0 // ${i%x2}|" -i unpack.S
50 asm unpack
51 ./pack --build bootloader.bin unpack.bin
52 PACKER=${i%x2} ./pack $file $file.${i%x2}
53 fi
54 mv unpack.lst unpack.lst.${i%x2}
55 if [ "${i%x2}" != "$i" ]; then
56 cp pack.bak pack
57 sed -e "s|^#define DOUBLE_PACKED|#define DOUBLE_PACKED 1 // $i|" -i unpack.S
58 asm unpack
59 ./pack --build bootloader.bin unpack.bin
60 PACKER=${i%x2} ./pack $file $file.$i
61 mv unpack.lst unpack.lst.$i
62 fi
63 done
64 }
66 # Rules to configure and make the package.
67 compile_rules()
68 {
69 sed -i 's|64, MT_VERSION "." GIT_HASH|65, MT_VERSION ".SliTaz"|;s|"\.x32"|".386"|' app/display.c
70 sed 's|gcc|gcc-83|;s|march=i586|march=i486|' -i build32/Makefile
71 patch -p0 < $stuff/memtest86\+-6-386.patch
72 cd build32
73 make boot/startup.o
74 objdump -t boot/startup.o | \
75 awk '/patch/ { print "sed -i \"s|" $5 "|0x" $1 "|\" ../boot/setup.S" }' | sh
76 make memtest.bin
77 tune_lzma memtest.bin 255,mf=bt2 LC 3 PB 2
78 }
81 # Rules to gen a SliTaz package suitable for Tazpkg.
82 genpkg_rules()
83 {
84 mkdir -p $fs/boot $install/usr/share/doc
85 cp $src/README* $install/usr/share/doc
86 cp $src/LICENSE $install/usr/share/doc
87 cp $src/build32/memtest.bin.lzma $fs/boot/memtest.exe
88 }
90 # Pre and post install commands for Tazpkg.
91 post_install()
92 {
93 [ -s $1/boot/isolinux/isolinux.cfg ] &&
94 ! grep -qs 'Check 32 bits memory' $1/boot/isolinux/isolinux.cfg && sed -i \
95 's|LABEL md5|LABEL memtest mem ram\
96 MENU LABEL Check 32 bits memory\
97 KERNEL /boot/memtest.exe\
98 \n&|' $1/boot/isolinux/isolinux.cfg
99 true
100 }