SliTaz Packages

Community Doc Forum Pro Shop Bugs Hg
.

Receipt for package "emu2"

# SliTaz package receipt.

PACKAGE="emu2"
VERSION="2021.01"
CATEGORY="system-tools"
TAGS="emulator dos vm86 8086"
SHORT_DESC="Simple x86 and DOS emulator for the Linux terminal."
MAINTAINER="pascal.bellard@slitaz.org"
LICENSE="GPL2"
TARBALL="$PACKAGE-$VERSION.tar.gz"
WEB_SITE="https://github.com/dmsc/emu2"
WGET_URL="$WEB_SITE/archive/v$VERSION.tar.gz"

BUILD_DEPENDS="gcc83"

# What is the latest version available today?
current_version()
{
    wget -O - ${WGET_URL%/arch*}/releases 2>/dev/null | \
    sed '/tag\//!d;s|.*tag/v*||;s|".*||;q'
}

# Rules to configure and make the package.
compile_rules()
{
    cp $stuff/* src
    sed -i '/HALT instruction/{N;s|.*|/*& */|}' src/cpu.c
    mkdir obj
    make CC=gcc-83 DESTDIR=$DESTDIR install
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
    mkdir -p $install/usr/doc $fs/usr
    cp $src/README.md $install/usr/doc
    cp -a $install/usr/bin $fs/usr
}

# Post install command for Tazpkg.
post_install()
{
    fmt="binfmt_misc"
    proc="/proc/sys/fs/binfmt_misc"
    exe=":EMU2:E::exe::/usr/bin/emu2:"
    com=":EMU2:E::com::/usr/bin/emu2:"
    cat > /tmp/runcom$$ <<EOT
[ ! -e $proc/register ] && modprobe $fmt && mount -t $fmt $fmt $proc
echo "$exe" >$proc/register
echo "$com" >$proc/register
EOT
    rc="$1/etc/init.d/local.sh"
    grep -q "$com" $rc || cat /tmp/runcom$$ >> $rc
    [ -n "$1" ] || . /tmp/runcom$$
    rm -f /tmp/runcom$$
}

# Pre remove command for Tazpkg.
pre_remove()
{
    echo -1 > /proc/sys/fs/binfmt_misc/EMU2
    sed -i '/binfmt_misc/{NN;/EMU2:E::com/d}' "$1/etc/init.d/local.sh"
}
5935 packages and 845883 files in cooking database (Thu Jun 27 00:01:54 2024)