# Template file for 'dev86'
pkgname=dev86
version=0.16.21
revision=5
short_desc="8086 cross development compiler, assembler and linker"
maintainer="Orphaned <orphan@voidlinux.org>"
license="GPL-1.0-or-later, GPL-2.0-or-later, LGPL-2.0-or-later"
homepage="https://github.com/lkundrak/dev86/"
distfiles="https://github.com/lkundrak/dev86/archive/v${version}.tar.gz"
checksum=49c7ee9102d45c2eef072bfb8a49ba3821c9fe3ef31ccd3290f658b667b579a8
nocross=yes
nostrip=yes
nopie=yes

pre_build() {
	for f in libc/bcc libc/misc libc/msdos libc/string libc/syscall \
		libc/bios; do
		sed -i -e "s|\$(CCFLAGS) ||g" ${wrksrc}/${f}/Makefile
	done

	# Force gnu89 as dev86 mixes k&r style
	vsed -i -e "s|CFLAGS	=|CFLAGS=-std=gnu89 |g" makefile.in
	vsed -i -e 's|CFLAGS=|CFLAGS=-std=gnu89 |g' dis88/Makefile
}

do_install() {
	make DIST=${DESTDIR} MANDIR=/usr/share/man install install-man
}

bin86_package() {
	short_desc="Complete 8086 assembler and loader"
	pkg_install() {
		vmove /usr/bin/as86
		vmove /usr/bin/ld86
		vmove /usr/bin/nm86
		vmove /usr/bin/objdump86
		vmove /usr/bin/size86
		vmove /usr/share/man/man1/as86.1
		vmove /usr/share/man/man1/ld86.1
	}
}
