# SliTaz package receipt. PACKAGE="memtest" VERSION="6.20" CATEGORY="base-system" SHORT_DESC="Memory failures detection tool." MAINTAINER="pascal.bellard@slitaz.org" LICENSE="GPL2" SOURCE="memtest86+" TARBALL="$SOURCE-$VERSION.tar.gz" WEB_SITE="https://www.memtest.org/" WGET_URL="https://github.com/memtest86plus/memtest86plus/archive/refs/tags/v$VERSION.tar.gz" BUILD_DEPENDS="xz lz4 lzsa" # What is the latest version available today? current_version() { wget -O - $WEB_SITE 2>/dev/null | \ sed '/tar.gz"/!d;s|.*memtest86.-||;s|.tar.*||;q' } asm() { cc -o $1.o -Wa,-a=$1.lst -c $1.S objcopy --only-section=.text -O binary $1.o $1.bin } tune_lzma() { file=$1 shift for i in lzma lz4x2 lzsa1x2 lzsa2x2 ; do cp $stuff/*.S $stuff/pack . sed "s/VERSION/$VERSION/;s|lzma1=|&nice=${1:-64},|" -i pack while [ -n "$2" ]; do sed "s|^#define PROP_$2 .*|#define PROP_$2 $3|" -i unlzma.S shift 2 done sed -i "s|uncompress|un${i%x2}|" unpack.S asm bootloader asm unpack cp pack pack.bak ./pack --build bootloader.bin unpack.bin PACKER=${i%x2} ./pack $file $file.${i%x2} if [ $(stat -c %s $file.${i%x2}) -ge $((0x101F0)) ]; then rm $file.${i%x2} cp pack.bak pack sed -e "s|^#define FLAT16.*// lzma case|#define FLAT16 0 // ${i%x2}|" -i unpack.S asm unpack ./pack --build bootloader.bin unpack.bin PACKER=${i%x2} ./pack $file $file.${i%x2} fi mv unpack.lst unpack.lst.${i%x2} if [ "${i#*x}" = "2" ]; then cp pack.bak pack sed -e "s|^#define DOUBLE_PACKED|#define DOUBLE_PACKED 1 // $i|" -i unpack.S asm unpack ./pack --build bootloader.bin unpack.bin PACKER=${i%x2} ./pack $file $file.$i mv unpack.lst unpack.lst.$i fi done } # Rules to configure and make the package. compile_rules() { sed -i 's|64, MT_VERSION "." GIT_HASH|65, MT_VERSION ".SliTaz"|;s|"\.x32"|".386"|' app/display.c sed 's|march=i586|march=i486|' -i build32/Makefile patch -p0 < $stuff/memtest86\+-6-386.patch cd build32 make boot/startup.o objdump -t boot/startup.o | \ awk '/patch/ { print "sed -i \"s|" $5 "|0x" $1 "|\" ../boot/setup.S" }' | sh make memtest.bin tune_lzma memtest.bin 255,mf=bt2 LC 3 PB 2 } # Rules to gen a SliTaz package suitable for Tazpkg. genpkg_rules() { mkdir -p $fs/boot $install/usr/share/doc cp $src/README* $install/usr/share/doc cp $src/build32/memtest.bin.lzma $fs/boot/memtest.exe } # Pre and post install commands for Tazpkg. post_install() { [ -s $1/boot/isolinux/isolinux.cfg ] && ! grep -qs 'Check 32 bits memory' $1/boot/isolinux/isolinux.cfg && sed -i \ 's|LABEL md5|LABEL memtest mem ram\ MENU LABEL Check 32 bits memory\ KERNEL /boot/memtest.exe\ \n&|' $1/boot/isolinux/isolinux.cfg true }