diff options
Diffstat (limited to 'gnu-efi/MAKEPKG')
| -rw-r--r-- | gnu-efi/MAKEPKG | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/gnu-efi/MAKEPKG b/gnu-efi/MAKEPKG new file mode 100644 index 0000000..94c971b --- /dev/null +++ b/gnu-efi/MAKEPKG | |||
| @@ -0,0 +1,100 @@ | |||
| 1 | #!/bin/mkpkg | ||
| 2 | # description: EFI application development toolkit | ||
| 3 | # url: https://sourceforge.net/projects/gnu-efi/ | ||
| 4 | |||
| 5 | name=gnu-efi | ||
| 6 | version=3.0.18 | ||
| 7 | release=1 | ||
| 8 | depends=() | ||
| 9 | makedeps=() | ||
| 10 | source=(https://downloads.sourceforge.net/sourceforge/gnu-efi/gnu-efi-$version.tar.bz2 | ||
| 11 | https://ftp.gnu.org/gnu/binutils/binutils-2.46.0.tar.xz | ||
| 12 | gnu-efi-3.0.18-clang.patch | ||
| 13 | gnu-efi-3.0.18-remove-linux-headers.patch | ||
| 14 | gnu-efi-3.0.19-fix-binutils-2.46.patch) | ||
| 15 | sha256sums=( | ||
| 16 | "7f212c96ee66547eeefb531267b641e5473d7d8529f0bd8ccdefd33cf7413f5c" | ||
| 17 | "d75a94f4d73e7a4086f7513e67e439e8fcdcbb726ffe63f4661744e6256b2cf2" | ||
| 18 | "cbd8f6af3b8f522fc65c65a96a589602a9a072a501740954f8617990029ae984" | ||
| 19 | "0996a5a167567066d7289cc4f9d576602cc61a3ea67608e76544b58bb0a47e94" | ||
| 20 | "173191018e118048025e6a5acc8e4fd9a401e58fa485bfab04dd09b5c24e4a4f" | ||
| 21 | ) | ||
| 22 | |||
| 23 | build() { | ||
| 24 | # Build private GNU binutils — need objcopy with EFI/pei- target support | ||
| 25 | cd $SRC/binutils-2.46.0 | ||
| 26 | CONFIG_SHELL=/bin/bash ./configure \ | ||
| 27 | --prefix=$SRC/binutils-local \ | ||
| 28 | --disable-nls \ | ||
| 29 | --disable-multilib \ | ||
| 30 | --disable-werror \ | ||
| 31 | --disable-gdb \ | ||
| 32 | --disable-gdbserver \ | ||
| 33 | --disable-gold \ | ||
| 34 | --disable-gprofng \ | ||
| 35 | --disable-sim \ | ||
| 36 | --disable-libdecnumber \ | ||
| 37 | --disable-readline \ | ||
| 38 | --enable-ld \ | ||
| 39 | --enable-targets=x86_64-linux,i686-linux,x86_64-pep \ | ||
| 40 | --with-system-zlib \ | ||
| 41 | CC=clang CXX=clang++ | ||
| 42 | make $MKPKG_MAKEFLAGS | ||
| 43 | make install | ||
| 44 | export PATH="$SRC/binutils-local/bin:$PATH" | ||
| 45 | |||
| 46 | cd $SRC/gnu-efi-$version | ||
| 47 | |||
| 48 | # apply patches | ||
| 49 | patch -N -p1 < $SRC/gnu-efi-3.0.18-clang.patch || true | ||
| 50 | patch -N -p1 < $SRC/gnu-efi-3.0.18-remove-linux-headers.patch || true | ||
| 51 | patch -N -p1 < $SRC/gnu-efi-3.0.19-fix-binutils-2.46.patch || true | ||
| 52 | |||
| 53 | # remove -Werror | ||
| 54 | sed -i 's/-Werror//g' Make.defaults | ||
| 55 | |||
| 56 | # fix CHAR16 typedef for clang — wchar_t causes pointer mismatch | ||
| 57 | sed -i 's/typedef wchar_t CHAR16/typedef uint16_t CHAR16/' \ | ||
| 58 | inc/x86_64/efibind.h | ||
| 59 | |||
| 60 | # musl: include clang's own headers first, then system | ||
| 61 | CPPINCLUDEDIR=$(clang -print-resource-dir 2>/dev/null)/include | ||
| 62 | export CFLAGS="-nostdinc -isystem $CPPINCLUDEDIR -isystem /usr/include" | ||
| 63 | |||
| 64 | mkdir -p $SRC/gnu-efi-$version/x86_64/lib/runtime | ||
| 65 | mkdir -p $SRC/gnu-efi-$version/x86_64/lib/x86_64 | ||
| 66 | mkdir -p $SRC/gnu-efi-$version/x86_64/gnuefi | ||
| 67 | mkdir -p $SRC/gnu-efi-$version/x86_64/inc | ||
| 68 | |||
| 69 | make -j1 ARCH=x86_64 \ | ||
| 70 | CC=clang \ | ||
| 71 | AS="$SRC/binutils-local/bin/as" \ | ||
| 72 | LD="$SRC/binutils-local/bin/ld" \ | ||
| 73 | AR=llvm-ar \ | ||
| 74 | RANLIB=llvm-ranlib \ | ||
| 75 | OBJCOPY="$SRC/binutils-local/bin/objcopy" \ | ||
| 76 | SUBDIRS="lib gnuefi inc" \ | ||
| 77 | all | ||
| 78 | |||
| 79 | make -j1 ARCH=x86_64 \ | ||
| 80 | CC=clang \ | ||
| 81 | AS="$SRC/binutils-local/bin/as" \ | ||
| 82 | LD="$SRC/binutils-local/bin/ld" \ | ||
| 83 | AR=llvm-ar \ | ||
| 84 | RANLIB=llvm-ranlib \ | ||
| 85 | OBJCOPY="$SRC/binutils-local/bin/objcopy" \ | ||
| 86 | PREFIX=/usr \ | ||
| 87 | LIBDIR=/usr/lib \ | ||
| 88 | INSTALLROOT=$PKG \ | ||
| 89 | SUBDIRS="lib gnuefi inc" \ | ||
| 90 | install | ||
| 91 | |||
| 92 | # xen and other tools expect efi/pe.h directly | ||
| 93 | cp $PKG/usr/include/efi/x86_64/pe.h $PKG/usr/include/efi/pe.h | ||
| 94 | } | ||
| 95 | signify() { | ||
| 96 | untrusted comment: public key | ||
| 97 | RWTZ9IduCSQ/mL8337TEUinPwT92xFEUpD92hkS7IxcOnzTt9QdpohT3 | ||
| 98 | } | ||
| 99 | |||
| 100 | # vim: filetype=sh | ||