Subject: [alpine-aports] [PATCH] new port: testing/wine-staging

From: Jens Staal <[email-masked]>
Date: Sat, 19 Nov 2016 11:13:55 +0100

A new port with wine-staging and gallium nine d3d9 patches
It is highly recommended to use my testing/mesa port if this is used
since that one comes with the gallium nine modules.

some stuff I have not figured out:
making provides() for sub-packages
making sure that wine-staging depends on the version-matched
wine-staging-libs rather than the older wine-libs.

>From d5254f45298e5fa59baf4f5a2b156835eb44c56e Mon Sep 17 00:00:00 2001
From: Jens Staal <[email-masked]>
Date: Sat, 19 Nov 2016 11:07:23 +0100
Subject: [PATCH] testing/wine-staging: new port

www.wine-staging.com
MS Windows binary compatibility library, experimental patches
---
 testing/wine-staging/APKBUILD       | 119 ++++++++++++++++++++++++++++++++++++
 testing/wine-staging/musl-fix.patch |  21 +++++++
 testing/wine-staging/nopie.patch    |  10 +++
 3 files changed, 150 insertions(+)
 create mode 100644 testing/wine-staging/APKBUILD
 create mode 100644 testing/wine-staging/musl-fix.patch
 create mode 100644 testing/wine-staging/nopie.patch

diff --git a/testing/wine-staging/APKBUILD b/testing/wine-staging/APKBUILD
new file mode 100644
index 0000000..ec3adc8
--- /dev/null
+++ b/testing/wine-staging/APKBUILD
@@ -0,0 +1,119 @@
+# Mantainer: Jens Staal <[email-masked]>
+# Contributor: Valery Kartel <[email-masked]>
+# Contributor: Sören Tempel <[email-masked]>
+# Contributor: Łukasz Jendrysik <[email-masked]>
+# Contributor: Natanael Copa <[email-masked]>
+pkgname=wine-staging
+pkgver=1.9.23
+_pkgver=${pkgver/_/-}
+pkgrel=1
+pkgdesc="A compatibility layer for running Windows programs"
+url="http://wine-staging.com"
+arch="x86_64"
+license="LGPL2+"
+subpackages="$pkgname-libs $pkgname-dev $pkgname-doc"
+depends_dev="$pkgname perl"
+makedepends="fontconfig-dev openldap-dev libxslt-dev libxxf86dga-dev
+	libxcursor-dev libxrandr-dev libxdamage-dev mesa-dev flex bison
+	libpng-dev libjpeg-turbo-dev freetype-dev ncurses-dev libressl-dev
+	libxcomposite-dev libxrender-dev libxinerama-dev zlib-dev
+	cups-dev alsa-lib-dev lcms-dev libxml2-dev paxmark dbus-dev libxi-dev
+	gnutls-dev tiff-dev v4l-utils-dev udisks2-dev autoconf automake paxmark"
+source="https://github.com/wine-compholio/wine-patched/archive/staging-$pkgver.tar.gz
+	https://github.com/sarnex/wine-d3d9-patches/archive/wine-d3d9-$pkgver.tar.gz
+	musl-fix.patch
+	nopie.patch"
+
+provides="wine=$pkgver wine-libs=$pkgver wine-dev=$pkgdir wine-doc=$pkgdir"
+
+_builddir="$srcdir"/wine-patched-staging-$_pkgver
+prepare() {
+	cd "$_builddir" 
+	patch -p1 -i "$srcdir"/wine-d3d9-patches-wine-d3d9-$_pkgver/staging-helper.patch
+	patch -p1 -i "$srcdir"/wine-d3d9-patchas-wine-d3d9-$_pkgver/wine-d3d9.patch
+	for i in $(ls $srcdir/*.patch); do
+		case $i in
+		*.patch) msg $i; patch -p1 -i $i || return 1;;
+		esac
+	done
+	aclocal && autoheader && autoreconf || return 1
+}
+
+build() {
+	cd "$_builddir"
+
+	case "$CARCH" in
+	x86_64) _win64=--enable-win64
+	esac
+	./configure \
+		--build=$CBUILD \
+		--host=$CHOST \
+		--prefix=/usr \
+		--libdir=/usr/lib \
+		--sysconfdir=/etc \
+		--localstatedir=/var \
+		--with-dbus \
+		--with-x \
+		--with-d3dadapter \
+		--disable-tests \
+		$_win64 \
+		|| return 1
+	make || return 1
+}
+
+package() {
+	cd "$_builddir"
+	make -j1 DESTDIR="$pkgdir" install || return 1
+
+	case "$CARCH" in
+	x86_64) _wine="wine64";;
+	*) _wine="wine";;
+	esac
+
+	paxmark -psmre "$pkgdir"/usr/bin/$_wine-preloader \
+		"$pkgdir"/usr/bin/$_wine
+}
+
+# no idea how to handle sub-packages and provides(). Temporary solution.
+
+dev() {
+	default_dev
+	install -d "$subpkgdir"/usr/bin
+	for file in widl wmc wrc winebuild winedump function_grep.pl winedbg winemaker winegcc winecpp wineg++; do
+		mv "$pkgdir"/usr/bin/$file "$subpkgdir"/usr/bin/
+	done
+	install -d "$subpkgdir"/usr/lib/wine
+	mv "$pkgdir"/usr/lib/wine/*.def "$subpkgdir"/usr/lib/wine/
+}
+
+doc() {
+	default_doc
+	rm -rf "$pkgdir"/usr/share/man
+	rm -fr "$subpkgdir"/usr/share/man/*.UTF-8
+}
+
+libs() {
+	default_libs
+	install -d "$subpkgdir"/usr/lib/wine/fakedlls
+	for ext in dll16 drv16 exe16 acm dll drv ds ocx sys tlb vxd; do
+		for file in `find "$pkgdir"/usr/lib/wine/fakedlls -name *.$ext -exec basename {} \;`; do
+			mv "$pkgdir"/usr/lib/wine/fakedlls/$file \
+				"$subpkgdir"/usr/lib/wine/fakedlls/
+			mv "$pkgdir"/usr/lib/wine/${file}.so \
+				"$subpkgdir"/usr/lib/wine/
+		done
+	done
+}
+
+md5sums="672b957aa8c4e0cb87dc232fc30889fb  staging-1.9.23.tar.gz
+d1ee58fce21cfa769fb0cee5d3b3dc78  wine-d3d9-1.9.23.tar.gz
+80c4e60c14a055b070e87338f22c6a0f  musl-fix.patch
+282865724e8d91958fa4e909a92c1035  nopie.patch"
+sha256sums="f4e6fe2046511f27b92c6ea8ddf382fe88cd22f63258a4e1097ae13cb8f6d518  staging-1.9.23.tar.gz
+3d2f5b6ef1b7b7f09934ac3c0beafe23b9062177e77623f233d53dda29215b19  wine-d3d9-1.9.23.tar.gz
+28059ac713a3636657267b9238ac9ca28416d7a3d6dbac142ed68dcbf460d88b  musl-fix.patch
+3449932791966342470286127a5b51f2035efc66a33bcfd6afdf0c5c1db17b67  nopie.patch"
+sha512sums="59769318ded2fb5643c3b16c067e23f97a6a893d2e9d579362cac9fb35fdfe3489d4d91f013a9a6eb23596b9f4798e7d5d9d86637b5aa21695a292a5560ff09c  staging-1.9.23.tar.gz
+52fee3f3ba48a5347f5153fa667c9257e725983fe70d1ef3d212acaa4d301441c60e35473aeb343bb16e3e4e8b15c4303e5fbbf74df9989c658b01511de2af6e  wine-d3d9-1.9.23.tar.gz
+6cbbaa561db4ea2048e1c5db3b66dddea554d8e2aa120e8615403a4891f1bd08fcd8c273ccb3fc6a824dac2fb53165237a1f4111d86cfee1de4a18fa7262ea39  musl-fix.patch
+f4c3ffc86ceb14c865282574f837c2114cdfa38df64327f17c2d5913cb85726d883e4a136ce38297612cda6dd47f9bdf80aff770368b8b846a642337f52a68bf  nopie.patch"
diff --git a/testing/wine-staging/musl-fix.patch b/testing/wine-staging/musl-fix.patch
new file mode 100644
index 0000000..0176c79
--- /dev/null
+++ b/testing/wine-staging/musl-fix.patch
@@ -0,0 +1,21 @@
+--- wine-1.7.8.orig/server/file.h
++++ wine-1.7.8/server/file.h
+@@ -21,6 +21,7 @@
+ #ifndef __WINE_SERVER_FILE_H
+ #define __WINE_SERVER_FILE_H
+ 
++#include <fcntl.h>
+ #include "object.h"
+ 
+ struct fd;
+--- ./dlls/ws2_32/socket.c.orig
++++ ./dlls/ws2_32/socket.c
+@@ -100,7 +100,7 @@
+ 
+ #ifdef HAVE_NETIPX_IPX_H
+ # include <netipx/ipx.h>
+-#elif defined(HAVE_LINUX_IPX_H)
++#elif defined(HAVE_LINUX_IPX_H) && defined(__GLIBC__)
+ # ifdef HAVE_ASM_TYPES_H
+ #  include <asm/types.h>
+ # endif
diff --git a/testing/wine-staging/nopie.patch b/testing/wine-staging/nopie.patch
new file mode 100644
index 0000000..54eb141
--- /dev/null
+++ b/testing/wine-staging/nopie.patch
@@ -0,0 +1,10 @@
+diff --git a/loader/Makefile.in b/loader/Makefile.in
+index 8190037..b4f2902 100644
+--- a/loader/Makefile.in
++++ b/loader/Makefile.in
+@@ -29,4 +29,4 @@ wine_preloader_OBJS = preloader.o
+ wine_preloader_LDFLAGS = -static -nostartfiles -nodefaultlibs -Wl,-Ttext=0x7c400000
+ 
+ wine64_preloader_OBJS = preloader.o
+-wine64_preloader_LDFLAGS = -static -nostartfiles -nodefaultlibs -Wl,-Ttext=0x7c400000
++wine64_preloader_LDFLAGS = -static -nostartfiles -nodefaultlibs -Wl,-Ttext=0x7c400000 -no-pie
-- 
2.10.2