### this file is sourced not run
PKGVER=2024.06.14
PKGBUILD=1
PKGARCH=x86_64

# source: james
TARBALL=dosbox-x-v${PKGVER}.tar.gz
MD5SUM=c6098c10e72aa2ed3393ea31e5fbc80a
hash=a4bbd19578571724857924e99cdf316580bc67e6 # for latest git master
SRC_URL=https://github.com/joncampbell123/dosbox-x/archive/$hash.tar.gz
#SRC_URL=https://github.com/joncampbell123/dosbox-x/archive/refs/tags/dosbox-x-v$PKGVER.tar.gz
BUNDLE=

SLACKCON='dosbox-x'
SLACKREQ='libpng ffmpeg libslirp' # internal libSDL2 and libSDL2-net
SLACKDESC="dosbox-x-sdl2: dosbox-x-sdl2 $PKGVER (DOS emulator)
dosbox-x-sdl2: Dosbox-X is a Jon Campbell fork of Dosbox with focus on accurate
dosbox-x-sdl2: emulation and retro-development. It features fine-grained control
dosbox-x-sdl2: over the emulated machine and in-emulator menu support. This is a
dosbox-x-sdl2: minimal build-debug build, there is no menu item or documentation.
dosbox-x-sdl2: Start it from terminal as dosbox-x.
dosbox-x-sdl2: Unlike the dosbox-x package, dosbox-x-sld2 provides full clipboard
dosbox-x-sdl2: copy/paste support between host and emulated environments.
dosbox-x-sdl2:
dosbox-x-sdl2: https://github.com/joncampbell123/dosbox-x/
dosbox-x-sdl2:
"

### default pkg_download
### prepare
pkg_prepare() {
	pkg_prepare_default &&
	cd tmp/dosbox-x* &&
	true
}

### default pkg_package
### build
pkg_build() {
	unset CFLAGS CXXFLAGS # build with default CFLAGS, not -Os
	export LDFLAGS="$LDFLAGS -Wl,--as-needed"
	CONFFLAGS="$CONFFLAGS --enable-core-inline --enable-avcodec"

	cd /tmp/dosbox-x* &&
	sed -i -e 's|F11|F12|g' src/shell/shell.cpp && # default host key in Linux is F12
	# use build-debug-sdl2 instead
	#./autogen.sh &&
	#pkg_build_autoconf &&
	./build-debug-sdl2 &&
	make install &&

	pkg_build_slackdesc &&

	# desktop
	mv /usr/share/applications/com.dosbox_x.DOSBox-X.desktop /usr/share/applications/dosbox-x.desktop &&

	# docs
	install -m644 README.* /usr/share/dosbox-x &&

	# fonts
	cp -a /tmp/pkg/FONTS /usr/share/dosbox-x &&
	cat > /usr/share/dosbox-x/printing.txt << "EOF" &&
https://sourceforge.net/p/dosbox/patches/43/
https://www.vogons.org/viewtopic.php?p=32371#32371

The printer emulates a black/white 48-dot matrix printer
supporting ESC/P and ESC/P2.

ESC/P(2) were the quasi-standards for matrix printers,
so the printer is able to emulate most 24/48-dot printers
from EPSON and other manufacturers.

If you enable printer emulation, copy the FONTS directory
to $HOME/.config/dosbox-x
EOF
	true
}

# vim: set ft=sh:
