diff options
author | Xiretza | 2019-06-11 21:56:08 +0200 |
---|---|---|
committer | Xiretza | 2019-06-19 00:22:35 +0200 |
commit | c8ba3b03b4d4b5e1bb219fe340b59607778b9f20 (patch) | |
tree | c4c470de5cd62c8611e9b481b9510242f2ec21af | |
download | aur-c8ba3b03b4d4b5e1bb219fe340b59607778b9f20.tar.gz |
Initial commit
-rw-r--r-- | .SRCINFO | 23 | ||||
-rw-r--r-- | PKGBUILD | 78 | ||||
-rw-r--r-- | spoof_homedir.c | 28 |
3 files changed, 129 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..8b3303187917 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,23 @@ +pkgbase = vivado + pkgdesc = FPGA/CPLD design suite for Xilinx devices + pkgver = 2018.3 + pkgrel = 1 + url = https://www.xilinx.com/products/design-tools/vivado.html + arch = x86_64 + license = custom + depends = ncurses5-compat-libs + depends = libpng12 + depends = lib32-libpng12 + depends = gtk2 + depends = fxload + depends = digilent.adept.runtime + depends = digilent.adept.utilities + depends = xterm + options = !strip + source = file:///Xilinx_Vivado_SDK_2018.3_1207_2324.tar.gz + source = spoof_homedir.c + md5sums = 8a3a75f26d0e20de21fc673ad9d40d0f + md5sums = 69d14ad64f6ec44e041eaa8ffcb6f87c + +pkgname = vivado + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..5019b824bd04 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,78 @@ +# Maintainer: xiretza <aur@xiretza.xyz> +# Contributor: Darren Wu <$(base64 --decode <<<'ZGFycmVuMTk5NzA4MTBAZ21haWwuY29tCg==')> + +# BUILD INSTRUCTIONS: +# +# 1. Log in to xilinx.com +# 2. Go to https://www.xilinx.com/support/download/index.html/content/xilinx/en/downloadNav/vivado-design-tools.html +# 3. Download "All OS installer Single-File Download" (.tar.gz) - WARNING: This file is about 19GB in size +# 4. Place the .tar.gz in the same directory as the PKGBUILD +# 5. Build! +# +# No refunds for broken AUR helpers, just use make(chroot)pkg. +# +# SOME MORE NOTES: +# +# This package is huge. The download alone is a 19GB .tar.gz, which decompresses to 20GB, +# and the final package (with compression disabled) is 28GB. Reserve at least 60GB when using makechrootpkg. +# +# It can also take about an hour to build, being mostly limited by I/O and single-thread +# performance. `namcap` takes another 30 minutes, make sure you're not running that automatically. +# +# It *also* requires a reasonably ugly hack to build: since package() is run under fakeroot, +# and the installer tries to access the home directory no matter what `--location` is set to, +# it fails during "Running post-install tasks" because it tries to access `/root`. +# To fix this, a tiny shared library (see spoof_homedir.c) is LD_PRELOADed. Its only job is to +# wrap the `getpwuid()` function and modify the original return value for uid==0. + +pkgname=vivado +pkgver=2018.3 +_more_ver=1207_2324 +pkgrel=1 +pkgdesc="FPGA/CPLD design suite for Xilinx devices" +url="https://www.xilinx.com/products/design-tools/vivado.html" +arch=('x86_64') +license=('custom') +depends=('ncurses5-compat-libs' + 'libpng12' + 'lib32-libpng12' + 'gtk2' + 'fxload' + 'digilent.adept.runtime' + 'digilent.adept.utilities' + 'xterm') + +source=("file:///Xilinx_Vivado_SDK_${pkgver}_${_more_ver}.tar.gz" + 'spoof_homedir.c') + +# checksum from https://www.xilinx.com/support/download.html +md5sums=('8a3a75f26d0e20de21fc673ad9d40d0f' + '69d14ad64f6ec44e041eaa8ffcb6f87c') + +options=('!strip') +PKGEXT=".pkg.tar" + +prepare() { + mkdir -p "$srcdir/installer_temp" +} + +build() { + # build our getpwuid() wrapper library + gcc -shared -fPIC -D "FAKE_HOME=\"$srcdir/installer_temp\"" spoof_homedir.c -o spoof_homedir.so -ldl +} + +package() { + cd "Xilinx_Vivado_SDK_${pkgver}_${_more_ver}" + + # LD_PRELOAD already contains libfakeroot.so, add our own library before that + LD_PRELOAD="$srcdir/spoof_homedir.so:$LD_PRELOAD" ./xsetup \ + --batch Install \ + --agree XilinxEULA,3rdPartyEULA,WebTalkTerms \ + --edition 'Vivado HL WebPACK' \ + --location "$pkgdir/opt/Xilinx" + + # clean up artefacts, remove leading $pkgdir from paths + rm -rf "$pkgdir/opt/Xilinx/.xinstall/" + sed -i -e "s|$pkgdir||g" "$pkgdir"/opt/Xilinx/{DocNav/.settings64-DocNav.{,c}sh,SDK/"$pkgver"/{settings64,.settings64-SDK_Core_Tools}.{,c}sh,Vivado/"$pkgver"/{settings64,.settings64-Vivado}.{,c}sh} +} + diff --git a/spoof_homedir.c b/spoof_homedir.c new file mode 100644 index 000000000000..caee9b033b2e --- /dev/null +++ b/spoof_homedir.c @@ -0,0 +1,28 @@ +#define _GNU_SOURCE +#include <dlfcn.h> +#include <pwd.h> +#include <sys/types.h> + +/* shared library that replaces the home directory for root in a `getpwuid()` call + * with a specific location + * + * inspired by https://rafalcieslak.wordpress.com/2013/04/02/dynamic-linker-tricks-using-ld_preload-to-cheat-inject-features-and-investigate-programs/ + * + * Usage: + * gcc -shared -fPIC -D 'FAKE_HOME="/path/to/fake/directory"' spoof_homedir.c -o spoof_homedir.so -ldl + * LD_PRELOAD="./spoof_homedir.so" binary_to_spoof + */ + +typedef struct passwd *(*orig_getpwuid_f_type)(uid_t uid); + +struct passwd *getpwuid(uid_t uid) { + orig_getpwuid_f_type orig_getpwuid; + orig_getpwuid = (orig_getpwuid_f_type)dlsym(RTLD_NEXT, "getpwuid"); + + struct passwd *result = orig_getpwuid(uid); + if (uid == 0) { + result->pw_dir = FAKE_HOME; + } + + return result; +} |