diff options
author | Manuel Reimer | 2020-03-07 13:52:38 +0100 |
---|---|---|
committer | Manuel Reimer | 2020-03-07 13:52:38 +0100 |
commit | 30fb7b64780ce7eca4f2c78505a0e4992ae39b95 (patch) | |
tree | ee3bf28797e40b5f834abbc5d84bacd1f351f866 | |
download | aur-30fb7b64780ce7eca4f2c78505a0e4992ae39b95.tar.gz |
Move wine-lol-glibc into its own subdirectory
-rw-r--r-- | .SRCINFO | 27 | ||||
-rw-r--r-- | PKGBUILD | 127 | ||||
-rw-r--r-- | bz20338.patch | 114 |
3 files changed, 268 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..cd0e2450b672 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,27 @@ +pkgbase = wine-lol-glibc + pkgdesc = GNU C Library patched for wine-lol + pkgver = 2.31 + pkgrel = 1 + url = https://www.gnu.org/software/libc + arch = x86_64 + license = GPL + license = LGPL + makedepends = git + makedepends = gd + makedepends = lib32-gcc-libs + makedepends = python + depends = linux-api-headers>=4.10 + depends = tzdata + depends = filesystem + optdepends = gd: for memusagestat + options = !strip + options = staticlibs + source = https://ftp.gnu.org/gnu/glibc/glibc-2.31.tar.xz + source = bz20338.patch + source = wine-lol-poc1-glibc.diff::https://bugs.winehq.org/attachment.cgi?id=64482 + md5sums = 78a720f17412f3c3282be5a6f3363ec6 + md5sums = 430673eccc78e52c249aa4b0f1786450 + md5sums = 65e6d204ab9ad787c8dce999c4ba5c17 + +pkgname = wine-lol-glibc + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..e61f44c487e5 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,127 @@ +# -*- mode: shell-script -*- +# Maintainer: Manuel Reimer <mail+wine@m-reimer.de> + +# This PKGBUILD builds a glibc with a "hack" required to run League Of Legends +# with wine-staging (wine-lol) +# See: https://bugs.winehq.org/show_bug.cgi?id=47198#c17 + +pkgname=wine-lol-glibc +pkgdesc='GNU C Library patched for wine-lol' +pkgver=2.31 +pkgrel=1 +arch=(x86_64) +url='https://www.gnu.org/software/libc' +license=(GPL LGPL) +makedepends=(git gd lib32-gcc-libs python) +depends=('linux-api-headers>=4.10' tzdata filesystem) +optdepends=('gd: for memusagestat') +options=(!strip staticlibs) +#_commit=067fc32968b601493f4b247a3ac00caeea3f3d61 +#source=(git+https://sourceware.org/git/glibc.git#commit=$_commit +source=(https://ftp.gnu.org/gnu/glibc/glibc-$pkgver.tar.xz + bz20338.patch + wine-lol-poc1-glibc.diff::https://bugs.winehq.org/attachment.cgi?id=64482) +md5sums=('78a720f17412f3c3282be5a6f3363ec6' + '430673eccc78e52c249aa4b0f1786450' + '65e6d204ab9ad787c8dce999c4ba5c17') + +prepare() { + mkdir -p glibc-build lib32-glibc-build + + [[ -d glibc-$pkgver ]] && ln -s glibc-$pkgver glibc + cd glibc + + local i; for i in ${source[@]}; do + case ${i%::*} in + *.patch) + msg2 "Applying ${i}" + patch -p1 -i "$srcdir/${i}" + ;; + esac + done + + # Add wine-lol glibc hack + patch -p1 -i "$srcdir/wine-lol-poc1-glibc.diff" +} + +build() { + local _configure_flags=( + --prefix=/opt/wine-lol + --sysconfdir=/etc + --datarootdir=/usr/share + --with-headers=/usr/include + --with-bugurl=https://bugs.archlinux.org/ + --enable-add-ons + --enable-bind-now + --enable-lock-elision + --enable-multi-arch + --enable-stack-protector=strong + --enable-stackguard-randomization + --enable-static-pie + --disable-profile + --disable-werror + ) + + cd "$srcdir/lib32-glibc-build" + export CC="gcc -m32 -mstackrealign" + export CXX="g++ -m32 -mstackrealign" + + echo "slibdir=/opt/wine-lol/lib32" >> configparms + echo "rtlddir=/opt/wine-lol/lib32" >> configparms + echo "sbindir=/opt/wine-lol/bin" >> configparms + echo "rootsbindir=/opt/wine-lol/bin" >> configparms + + # remove fortify for building libraries + CPPFLAGS=${CPPFLAGS/-D_FORTIFY_SOURCE=2/} + CFLAGS=${CFLAGS/-fno-plt/} + CXXFLAGS=${CXXFLAGS/-fno-plt/} + + "$srcdir/glibc/configure" \ + --host=i686-pc-linux-gnu \ + --libdir=/opt/wine-lol/lib32 \ + --libexecdir=/opt/wine-lol/lib32 \ + ${_configure_flags[@]} + + # build libraries with fortify disabled + echo "build-programs=no" >> configparms + make + + # re-enable fortify for programs + sed -i "/build-programs=/s#no#yes#" configparms + + echo "CC += -D_FORTIFY_SOURCE=2" >> configparms + echo "CXX += -D_FORTIFY_SOURCE=2" >> configparms + make +} + +package() { + cd lib32-glibc-build + + make install_root="$pkgdir" install + + # Dynamic linker +# install -d "$pkgdir/opt/wine-lol/lib" +# ln -s ../lib32/ld-linux.so.2 "$pkgdir/opt/wine-lol/lib/" + + # Symlink /opt/wine-lol/lib32/locale to /usr/lib/locale + ln -s /usr/lib/locale "$pkgdir/opt/wine-lol/lib32/locale" + + if check_option 'debug' n; then + find "$pkgdir"/opt/wine-lol/bin -type f -executable -exec strip $STRIP_BINARIES {} + 2> /dev/null || true + find "$pkgdir"/opt/wine-lol/lib -name '*.a' -type f -exec strip $STRIP_STATIC {} + 2> /dev/null || true + + find "$pkgdir"/opt/wine-lol/lib32 -name '*.a' -type f -exec strip $STRIP_STATIC {} + 2> /dev/null || true + find "$pkgdir"/opt/wine-lol/lib32 \ + -not -name 'ld-*.so' \ + -not -name 'libc-*.so' \ + -not -name 'libpthread-*.so' \ + -not -name 'libthread_db-*.so' \ + -name '*-*.so' -type f -exec strip $STRIP_SHARED {} + 2> /dev/null || true + fi + + # These have been installed to the same location as the files in the + # "system glibc" intentionally to make our glibc use the system files. + rm -r "$pkgdir/usr/share" + rm -r "$pkgdir/etc" + rmdir "$pkgdir/usr" # should be empty now +} diff --git a/bz20338.patch b/bz20338.patch new file mode 100644 index 000000000000..ddcc3efe4202 --- /dev/null +++ b/bz20338.patch @@ -0,0 +1,114 @@ +From 74250a7cdf106d4ca7d9506e6d5dc7c448dc3434 Mon Sep 17 00:00:00 2001 +From: David Michael <david.michael@coreos.com> +Date: Thu, 15 Dec 2016 15:22:57 -0800 +Subject: [PATCH] gshadow: Sync fgetsgent_r.c with grp/fgetgrent_r.c + + [BZ #20338] + * gshadow/fgetsgent_r.c: Include <libio/iolibio.h>. + (flockfile): New macro. + (funlockfile): Likewise. + (__fgetsgent_r): Sync with __fgetgrent_r. + * nss/nss_files/files-sgrp.c: Fix "fgetsgent_r.c" typo. +--- + gshadow/fgetsgent_r.c | 35 ++++++++++++++++++++++++----------- + nss/nss_files/files-sgrp.c | 2 +- + 2 files changed, 25 insertions(+), 12 deletions(-) + +diff --git a/gshadow/fgetsgent_r.c b/gshadow/fgetsgent_r.c +index b70f6fa..02cd33a 100644 +--- a/gshadow/fgetsgent_r.c ++++ b/gshadow/fgetsgent_r.c +@@ -20,39 +20,44 @@ + #include <gshadow.h> + #include <stdio.h> + ++#include <libio/iolibio.h> ++#define flockfile(s) _IO_flockfile (s) ++#define funlockfile(s) _IO_funlockfile (s) ++ + /* Define a line parsing function using the common code + used in the nss_files module. */ + + #define STRUCTURE sgrp + #define ENTNAME sgent +-#define EXTERN_PARSER 1 ++#define EXTERN_PARSER 1 + struct sgent_data {}; + + #include <nss/nss_files/files-parse.c> + + +-/* Read one shadow entry from the given stream. */ ++/* Read one entry from the given stream. */ + int + __fgetsgent_r (FILE *stream, struct sgrp *resbuf, char *buffer, size_t buflen, + struct sgrp **result) + { + char *p; ++ int parse_result; + +- _IO_flockfile (stream); ++ flockfile (stream); + do + { + buffer[buflen - 1] = '\xff'; + p = fgets_unlocked (buffer, buflen, stream); +- if (p == NULL && feof_unlocked (stream)) ++ if (__builtin_expect (p == NULL, 0) && feof_unlocked (stream)) + { +- _IO_funlockfile (stream); ++ funlockfile (stream); + *result = NULL; + __set_errno (ENOENT); + return errno; + } +- if (p == NULL || buffer[buflen - 1] != '\xff') ++ if (__builtin_expect (p == NULL, 0) || buffer[buflen - 1] != '\xff') + { +- _IO_funlockfile (stream); ++ funlockfile (stream); + *result = NULL; + __set_errno (ERANGE); + return errno; +@@ -61,13 +66,21 @@ __fgetsgent_r (FILE *stream, struct sgrp *resbuf, char *buffer, size_t buflen, + /* Skip leading blanks. */ + while (isspace (*p)) + ++p; +- } while (*p == '\0' || *p == '#' /* Ignore empty and comment lines. */ ++ } while (*p == '\0' || *p == '#' /* Ignore empty and comment lines. */ + /* Parse the line. If it is invalid, loop to + get the next line of the file to parse. */ +- || ! parse_line (buffer, (void *) resbuf, (void *) buffer, buflen, +- &errno)); ++ || ! (parse_result = parse_line (p, resbuf, ++ (void *) buffer, buflen, ++ &errno))); ++ ++ funlockfile (stream); + +- _IO_funlockfile (stream); ++ if (__builtin_expect (parse_result, 0) == -1) ++ { ++ /* The parser ran out of space. */ ++ *result = NULL; ++ return errno; ++ } + + *result = resbuf; + return 0; +diff --git a/nss/nss_files/files-sgrp.c b/nss/nss_files/files-sgrp.c +index 15dc659..05c3805 100644 +--- a/nss/nss_files/files-sgrp.c ++++ b/nss/nss_files/files-sgrp.c +@@ -23,7 +23,7 @@ + #define DATABASE "gshadow" + struct sgent_data {}; + +-/* Our parser function is already defined in sgetspent_r.c, so use that ++/* Our parser function is already defined in sgetsgent_r.c, so use that + to parse lines from the database file. */ + #define EXTERN_PARSER + #include "files-parse.c" +-- +2.7.4 + |