void-packages/srcpkgs/dmd/template

88 lines
2.4 KiB
Bash

# Template file for 'dmd'
pkgname=dmd
version=2.077.0
revision=2
wrksrc="dmd2"
short_desc="The Digital Mars D compiler"
maintainer="Juan RP <xtraeme@voidlinux.eu>"
homepage="http://www.digitalmars.com/d/2.0/"
license="Boost Software License 1.0"
distfiles="http://downloads.dlang.org/releases/2.x/${version}/dmd.${version}.linux.tar.xz
https://raw.githubusercontent.com/dlang/dmd/5f3bdcde7a870509a3e2f1af48909c62bf8a18e7/config.sh"
skip_extraction="config.sh"
checksum="54471d7c5fdb73dd38cd8ab1d8ac4cb6b7aca0d0d18e7a9f38dcafcb242732f4
778834ad25225c6656565b3c66437543ed40066b9e40fde657c4d632fd4e391c"
if [ "$XBPS_TARGET_MACHINE" = "x86_64" ]; then
_archbits=64
elif [ "$XBPS_TARGET_MACHINE" = "i686" ]; then
_archbits=32
fi
only_for_archs="x86_64"
conf_files="/etc/dmd.conf"
nopie=yes
hostmakedepends="curl"
depends="libphobos>=${version} gcc"
do_build() {
cp ${XBPS_SRCDISTDIR}/${pkgname}-${version}/config.sh src
chmod +x src/config.sh
cd src
# missing file in archive for some reason?
mkdir -p res
cp ${FILESDIR}/default_ddoc_theme.ddoc res
cd dmd
mkdir src
cp osmodel.mak src
make ${makejobs} -f posix.mak MODEL=${_archbits} AUTO_BOOTSTRAP=1 PIC=1
cd ../druntime
make ${makejobs} -f posix.mak MODEL=${_archbits} DMD=../dmd/dmd PIC=1
cd ../phobos
make ${makejobs} -f posix.mak MODEL=${_archbits} DMD=../dmd/dmd PIC=1
}
do_install() {
vbin src/dmd/dmd
vinstall ${FILESDIR}/dmd.conf 644 etc
vman man/man1/dmd.1
vman man/man1/rdmd.1
vman man/man5/dmd.conf.5
vmkdir usr/share/d/samples
cp -r samples/d/* ${DESTDIR}/usr/share/d/samples/
find ${DESTDIR}/usr/share/d/samples -type f | xargs chmod 0644
for f in ddemangle dumpobj obj2asm rdmd; do
vbin linux/bin${_archbits}/${f}
done
}
libphobos_package() {
short_desc="The phobos D standard library for DMD"
license="Boost License"
pkg_install() {
vinstall ${wrksrc}/src/druntime/generated/linux/release/$_archbits/libdruntime.a 644 usr/lib libdruntime.a
vinstall ${wrksrc}/src/phobos/generated/linux/release/$_archbits/libphobos2.a 644 usr/lib libphobos2.a
vmkdir usr/include/d
cp -r ${wrksrc}/src/phobos/{*.d,etc,std} ${PKGDESTDIR}/usr/include/d
vmkdir usr/include/d/druntime
cp -r ${wrksrc}/src/druntime/import ${PKGDESTDIR}/usr/include/d/druntime
vmkdir usr/share/doc/d/
cp -r ${wrksrc}/html ${PKGDESTDIR}/usr/share/doc/d/
find ${PKGDESTDIR}/usr/share/doc/d -type f | xargs chmod 0644
vlicense ${wrksrc}/src/druntime/LICENSE
}
}