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

# source: james
TARBALL=dosbox-0.74-2.tar.gz
MD5SUM=7110ee24a45a2b4951ad52eb1a3722be
SRC_URL=http://downloads.sourceforge.net/dosbox/$TARBALL
BUNDLE=

SLACKREQ='libSDL libpng libSDL-net libSDL-sound'
SLACKDESC="dosbox: dosbox $PKGVER (DOS emulator)  
dosbox:  
dosbox: DOSBox emulates an Intel x86 PC, complete with sound, graphics, mouse, 
dosbox: joystick, modem, etc., necessary for running many old MS-DOS games 
dosbox: that simply cannot be run on modern PCs and operating systems, such as 
dosbox: Microsoft Windows XP, Windows Vista, Linux and FreeBSD. However, it is 
dosbox: not restricted to running only games. In theory, any MS-DOS or PC-DOS 
dosbox: (referred to commonly as DOS) application should run in DOSBox.  
dosbox: 
dosbox: https://www.dosbox.com/
dosbox: 
"

### default pkg_download
### prepare
pkg_prepare() {
	pkg_prepare_default &&
	cd tmp/dosbox* &&

	# upstream patch to fix SDL issues
	patch -Np0 -i ../pkg/74-2-events.diff &&
	true
}

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

	# desktop
	mkdir -p /usr/share/applications /usr/share/pixmaps &&
	install -m644 /tmp/pkg/dosbox.desktop /usr/share/applications &&
	install -m644 /tmp/pkg/dosbox48.png /usr/share/icons &&

	# docs
	install -dm755 /usr/share/dosbox &&
	install -m644 README docs/README.video /usr/share/dosbox
}
