void-packages/srcpkgs/catalyst/template
2019-03-02 16:55:54 -03:00

172 lines
6.2 KiB
Bash

# Template file for 'catalyst'
_release="15.12"
_build="151217a-297685e"
_desc="AMD catalyst driver ${_release} for Linux"
pkgname=catalyst
version=15.302
revision=2
maintainer="Juan RP <xtraeme@voidlinux.org>"
license="Proprietary AMD license"
homepage="http://www.amd.com"
archs="i686 x86_64"
hostmakedepends="unzip wget"
subpackages="${pkgname}-opencl ${pkgname}-dkms ${pkgname}-libs"
depends="${pkgname}-dkms-${version}_${revision}"
conflicts="nvidia>=0 xserver-abi-video>19_1"
short_desc="${_desc} - Utilities"
repository="nonfree"
create_wrksrc=yes
nopie=yes
XBPS_FETCH_CMD="wget --referer='http://support.amd.com/en-us/download/desktop?os=Linux+x86_64' "
distfiles="https://www2.ati.com/drivers/linux/radeon-crimson-${_release}-${version}-${_build}.zip"
checksum=704f2dfc14681f76dae3b4120c87b1ded33cf43d5a1d800b6de5ca292bb61e58
if [ "$XBPS_MACHINE" = "i686" ]; then
_ARCHDIR="x86"
elif [ "$XBPS_MACHINE" = "x86_64" ]; then
_ARCHDIR="x86_64"
_ARCHLIB="64"
_ARCHXPIC="_64a"
fi
do_build() {
cd fglrx-${version}
/bin/sh ./*.run --extract ./
patch -Np1 -i ${FILESDIR}/lano1106_fglrx_intel_iommu.patch
patch -Np1 -i ${FILESDIR}/lano1106_kcl_agp_13_4.patch
patch -Np1 -i ${FILESDIR}/4.3-kolasa-seq_printf.patch
patch -Np1 -i ${FILESDIR}/4.3-gentoo-mtrr.patch
patch -Np1 -i ${FILESDIR}/fglrx_gpl_symbol.patch
[ "$XBPS_MACHINE" = "i686" ] && patch -Np1 -i ${FILESDIR}/crimson_i686_xg.patch
patch -Np1 -i ${FILESDIR}/4.4-manjaro-xstate.patch
patch -Np1 -i ${FILESDIR}/grsec_arch.patch
patch -Np1 -i ${FILESDIR}/4.6-void-user_page.patch
patch -Np1 -i ${FILESDIR}/4.7-arch-cpu_has_pge-v2.patch
}
do_install() {
cd fglrx-${version}
install -dm755 ${DESTDIR}/usr/bin
install -dm755 ${DESTDIR}/usr/lib/{dri,xorg/modules/{drivers,extensions/fglrx,linux},systemd/system}
install -dm755 ${DESTDIR}/usr/include/GL
install -dm755 ${DESTDIR}/etc/{ati,acpi/events,security/console.apps}
install -dm755 ${DESTDIR}/usr/share/{applications,ati/amdcccle,man/man8,pixmaps}
# binaries
install -m755 common/usr/sbin/* ${DESTDIR}/usr/bin/
install -m755 common/usr/X11R6/bin/* ${DESTDIR}/usr/bin/
install -m755 arch/${_ARCHDIR}/usr/bin/* ${DESTDIR}/usr/bin/
install -m755 arch/${_ARCHDIR}/usr/X11R6/bin/* ${DESTDIR}/usr/bin/
# headers
install -m644 common/usr/include/GL/* ${DESTDIR}/usr/include/GL/
# xorg/dri/gl/... drivers
pushd xpic${_ARCHXPIC}/usr/X11R6/lib${_ARCHLIB}/modules
install -m755 *.so ${DESTDIR}/usr/lib/xorg/modules/
install -m755 drivers/*.so ${DESTDIR}/usr/lib/xorg/modules/drivers/
install -m755 linux/*.so ${DESTDIR}/usr/lib/xorg/modules/linux/
install -m755 extensions/fglrx/fglrx-libglx.so ${DESTDIR}/usr/lib/xorg/modules/extensions
ln -sf fglrx-libglx.so ${DESTDIR}/usr/lib/xorg/modules/extensions/libglx.so
ln -sf fglrx-libglx.so ${DESTDIR}/usr/lib/xorg/modules/extensions/libglx.so.1
popd
pushd arch/${_ARCHDIR}/usr/X11R6/lib${_ARCHLIB}
install -m755 modules/dri/fglrx_dri.so ${DESTDIR}/usr/lib/xorg/modules/drivers/
ln -sfr ${DESTDIR}/usr/lib/xorg/modules/drivers/fglrx_dri.so ${DESTDIR}/usr/lib/dri/fglrx_dri.so
install -m755 fglrx/fglrx-libGL.so.1.2 ${DESTDIR}/usr/lib/
ln -sf fglrx-libGL.so.1.2 ${DESTDIR}/usr/lib/libGL.so
ln -sf fglrx-libGL.so.1.2 ${DESTDIR}/usr/lib/libGL.so.1
install -m755 *.so* ${DESTDIR}/usr/lib/
install -m644 libAMDXvBA.cap ${DESTDIR}/usr/lib/
popd
pushd arch/${_ARCHDIR}/usr/lib${_ARCHLIB}
install -m755 *.so* ${DESTDIR}/usr/lib/
# needed symlinks
ln -s libatiuki.so.1.0 ${DESTDIR}/usr/lib/libatiuki.so.1
ln -s libAMDXvBA.so.1.0 ${DESTDIR}/usr/lib/libAMDXvBA.so.1
ln -s libXvBAW.so.1.0 ${DESTDIR}/usr/lib/libXvBAW.so
ln -s libXvBAW.so.1.0 ${DESTDIR}/usr/lib/libXvBAW.so.1
ln -s libfglrx_dm.so.1.0 ${DESTDIR}/usr/lib/libfglrx_dm.so.1
popd
# various files
install -m644 common/usr/share/man/man8/* ${DESTDIR}/usr/share/man/man8/
install -m644 common/usr/share/applications/* ${DESTDIR}/usr/share/applications/
install -m644 common/usr/share/icons/* ${DESTDIR}/usr/share/pixmaps/
install -m644 common/usr/share/ati/amdcccle/* ${DESTDIR}/usr/share/ati/amdcccle/
install -m644 common/etc/ati/* ${DESTDIR}/etc/ati/
install -m644 common/usr/share/applications/*.desktop ${DESTDIR}/usr/share/applications/
# use ACPI example files
install -m755 common/usr/share/doc/fglrx/examples/etc/acpi/*.sh ${DESTDIR}/etc/acpi/
install -m644 common/usr/share/doc/fglrx/examples/etc/acpi/events/* ${DESTDIR}/etc/acpi/events/
# provided in catalyst-opencl package
rm ${DESTDIR}/usr/lib/lib{amdocl*,OpenCL}.so*
# we remove the watermark
install -m644 common/etc/ati/* ${DESTDIR}/etc/ati/
# licenses
install -Dm644 common/usr/share/doc/fglrx/LICENSE.TXT \
${DESTDIR}/usr/share/licenses/${pkgname}/LICENSE.TXT
install -Dm644 common/usr/share/doc/amdcccle/ccc_copyrights.txt \
${DESTDIR}/usr/share/licenses/${pkgname}/amdcccle_copyrights.txt
}
catalyst-dkms_package() {
short_desc="${_desc} - DKMS kernel module"
depends="dkms"
dkms_modules="fglrx ${version}_${revision}"
pkg_install() {
local _fglrx=fglrx-${version}_${revision}
vmkdir etc/cmdline.d
vmkdir usr/lib/dracut/dracut.conf.d
vmkdir usr/lib/modprobe.d
vmkdir usr/lib/modules-load.d
vmkdir usr/src/${_fglrx}
cd ${wrksrc}/fglrx-${version}
cp -r common/lib/modules/fglrx/build_mod/* ${PKGDESTDIR}/usr/src/${_fglrx}
vinstall arch/${_ARCHDIR}/lib/modules/fglrx/build_mod/libfglrx_ip.a 644 usr/src/${_fglrx}
vinstall ${FILESDIR}/dkms.conf 644 usr/src/${_fglrx}
sed -i -e "s/@VERSION@/${version}-${revision}/" ${PKGDESTDIR}/usr/src/${_fglrx}/dkms.conf
echo "nomodeset" > ${PKGDESTDIR}/etc/cmdline.d/catalyst.conf
echo "omit_dracutmodules+=\" drm \"" > ${PKGDESTDIR}/usr/lib/dracut/dracut.conf.d/99-catalyst.conf
echo "blacklist radeon" > ${PKGDESTDIR}/usr/lib/modprobe.d/catalyst.conf
echo "fglrx" > ${PKGDESTDIR}/usr/lib/modules-load.d/catalyst.conf
}
}
catalyst-opencl_package() {
short_desc="${_desc} - OpenCL implementation"
depends="libOpenCL"
pkg_install() {
cd ${wrksrc}/fglrx-${version}/arch/${_ARCHDIR}
vmkdir usr/lib
vmkdir etc/OpenCL/vendors
vbin usr/bin/clinfo
install -m644 etc/OpenCL/vendors/amdocl*.icd ${PKGDESTDIR}/etc/OpenCL/vendors
install -m755 usr/lib${_ARCHLIB}/libamdocl*.so ${PKGDESTDIR}/usr/lib/
}
}
catalyst-libs_package() {
short_desc="${_desc} - libraries"
provides="libGL-${version}_${revision}"
replaces="libGL>=0"
pkg_install() {
vmove usr/lib
}
}