2015-01-10 06:30:31 -08:00
|
|
|
#!/bin/sh
|
2015-01-07 00:49:06 -08:00
|
|
|
#
|
|
|
|
# Script to automatically install all Wine Staging patches
|
|
|
|
#
|
2017-01-19 01:20:53 -08:00
|
|
|
# Copyright (C) 2015-2017 Sebastian Lackner
|
2015-01-07 00:49:06 -08:00
|
|
|
#
|
|
|
|
# This library is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU Lesser General Public
|
|
|
|
# License as published by the Free Software Foundation; either
|
|
|
|
# version 2.1 of the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This library is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
# Lesser General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU Lesser General Public
|
|
|
|
# License along with this library; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
#
|
|
|
|
|
|
|
|
# Show usage information
|
|
|
|
usage()
|
|
|
|
{{
|
|
|
|
echo ""
|
|
|
|
echo "Usage: ./patchinstall.sh [DESTDIR=path] [--all] [-W patchset] [patchset ...]"
|
|
|
|
echo ""
|
|
|
|
echo "Autogenerated script to apply all Wine Staging patches on your Wine"
|
2016-01-09 18:50:34 -08:00
|
|
|
echo "source tree."
|
2015-01-07 00:49:06 -08:00
|
|
|
echo ""
|
|
|
|
echo "Configuration:"
|
2015-01-08 05:59:00 -08:00
|
|
|
echo " DESTDIR=path Specify the path to the wine source tree"
|
2015-01-12 22:54:16 -08:00
|
|
|
echo " --all Select all patches"
|
2015-05-06 10:46:15 -07:00
|
|
|
echo " --force-autoconf Run autoreconf and tools/make_requests after each patch"
|
2015-01-12 22:54:16 -08:00
|
|
|
echo " --help Display this help and exit"
|
|
|
|
echo " --no-autoconf Do not run autoreconf and tools/make_requests"
|
2016-01-10 08:19:40 -08:00
|
|
|
echo " --no-patchlist Do not apply patchlist (needed for 'wine --patches')"
|
2015-08-25 14:00:32 -07:00
|
|
|
echo " --upstream-commit Print the upstream Wine commit SHA1 and exit"
|
|
|
|
echo " --version Show version information and exit"
|
2015-01-12 22:54:16 -08:00
|
|
|
echo " -W patchset Exclude a specific patchset"
|
2015-01-07 00:49:06 -08:00
|
|
|
echo ""
|
|
|
|
echo "Backends:"
|
2015-01-08 05:59:00 -08:00
|
|
|
echo " --backend=patch Use regular 'patch' utility to apply patches (default)"
|
2016-08-10 20:54:31 -07:00
|
|
|
echo " --backend=eapply Use 'eapply' to apply patches (Gentoo only)"
|
|
|
|
echo " --backend=epatch Use 'epatch' to apply patches (Gentoo only, deprecated)"
|
2015-01-08 05:59:00 -08:00
|
|
|
echo " --backend=git-am Use 'git am' to apply patches"
|
|
|
|
echo " --backend=git-apply Use 'git apply' to apply patches"
|
2015-01-12 10:29:22 -08:00
|
|
|
echo " --backend=stg Import the patches using stacked git"
|
2015-01-07 00:49:06 -08:00
|
|
|
echo ""
|
|
|
|
}}
|
|
|
|
|
2015-08-25 14:00:32 -07:00
|
|
|
# Get the upstream commit sha
|
|
|
|
upstream_commit()
|
|
|
|
{{
|
2016-01-06 12:26:02 -08:00
|
|
|
echo "{upstream_commit}"
|
2015-08-25 14:00:32 -07:00
|
|
|
}}
|
|
|
|
|
2015-05-06 12:52:06 -07:00
|
|
|
# Show version information
|
|
|
|
version()
|
|
|
|
{{
|
2016-01-06 11:11:28 -08:00
|
|
|
echo "{staging_version}"
|
2018-02-17 15:37:32 -08:00
|
|
|
echo "Copyright (C) 2014-2018 the Wine Staging project authors."
|
|
|
|
echo "Copyright (C) 2018 Alistair Leslie-Hughes"
|
2015-05-06 12:52:06 -07:00
|
|
|
echo ""
|
|
|
|
echo "Patchset to be applied on upstream Wine:"
|
2015-08-25 14:00:32 -07:00
|
|
|
echo " commit $(upstream_commit)"
|
2015-05-06 12:52:06 -07:00
|
|
|
echo ""
|
|
|
|
}}
|
|
|
|
|
2015-01-07 00:49:06 -08:00
|
|
|
# Critical error, abort
|
|
|
|
abort()
|
|
|
|
{{
|
2017-01-19 01:20:53 -08:00
|
|
|
printf '%s\n' "ERROR: $1" >&2
|
2015-01-07 00:49:06 -08:00
|
|
|
exit 1
|
|
|
|
}}
|
|
|
|
|
2015-01-25 18:46:33 -08:00
|
|
|
# Show a warning
|
|
|
|
warning()
|
|
|
|
{{
|
2017-01-19 01:20:53 -08:00
|
|
|
printf '%s\n' "WARNING: $1" >&2
|
2015-01-25 18:46:33 -08:00
|
|
|
}}
|
|
|
|
|
2015-01-07 00:49:06 -08:00
|
|
|
{patch_helpers}
|
|
|
|
|
|
|
|
# Default settings
|
|
|
|
patch_enable_all 0
|
2015-01-12 22:54:16 -08:00
|
|
|
enable_patchlist=1
|
|
|
|
enable_autoconf=1
|
2015-01-07 00:49:06 -08:00
|
|
|
patchlist="/dev/null"
|
|
|
|
backend="patch"
|
|
|
|
|
2015-01-19 18:54:35 -08:00
|
|
|
# Find location of patches
|
2017-06-13 13:37:23 -07:00
|
|
|
patchdir="$(cd "$(dirname "$0")" && pwd)"
|
2015-02-22 11:46:03 -08:00
|
|
|
if test ! -f "$patchdir/patchinstall.sh"; then
|
2015-01-19 18:54:35 -08:00
|
|
|
if test -f ./patchinstall.sh; then
|
|
|
|
patchdir="$(pwd)"
|
|
|
|
else
|
|
|
|
abort "Failed to find patch directory."
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Parse commandline arguments
|
2015-01-10 06:30:31 -08:00
|
|
|
if test "$#" -eq 0; then
|
2015-01-07 00:49:06 -08:00
|
|
|
abort "No commandline arguments given, don't know what to do."
|
|
|
|
fi
|
|
|
|
|
2015-01-10 06:30:31 -08:00
|
|
|
while test "$#" -gt 0; do
|
2015-01-07 00:49:06 -08:00
|
|
|
case "$1" in
|
|
|
|
DESTDIR=*)
|
|
|
|
DESTDIR="${{1#*=}}"
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
|
|
|
|
--all)
|
|
|
|
patch_enable_all 1
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
|
|
|
|
--backend=*)
|
|
|
|
backend="${{1#*=}}"
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
|
2015-05-06 10:46:15 -07:00
|
|
|
--force-autoconf)
|
|
|
|
enable_autoconf=2
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
|
2015-01-07 00:49:06 -08:00
|
|
|
--help)
|
|
|
|
usage
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
|
2015-01-12 22:54:16 -08:00
|
|
|
--no-patchlist)
|
|
|
|
enable_patchlist=0
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
|
|
|
|
--no-autoconf)
|
|
|
|
enable_autoconf=0
|
2015-01-07 00:49:06 -08:00
|
|
|
shift
|
|
|
|
;;
|
|
|
|
|
2015-08-25 14:00:32 -07:00
|
|
|
--upstream-commit)
|
|
|
|
upstream_commit
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
|
2015-05-06 12:52:06 -07:00
|
|
|
--version)
|
|
|
|
version
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
|
2015-01-07 00:49:06 -08:00
|
|
|
-W)
|
2015-05-06 13:37:54 -07:00
|
|
|
# Disable patchset
|
|
|
|
if ! patch_enable "$2" 2; then
|
|
|
|
abort "Wrong usage of -W commandline argument, expected patchname."
|
|
|
|
fi
|
|
|
|
shift
|
2015-01-07 00:49:06 -08:00
|
|
|
shift
|
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
2015-05-06 13:37:54 -07:00
|
|
|
# Enable patchset
|
|
|
|
if ! patch_enable "$1" 1; then
|
|
|
|
abort "Unknown commandline argument $1."
|
|
|
|
fi
|
|
|
|
shift
|
|
|
|
;;
|
2015-01-07 00:49:06 -08:00
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2015-01-14 21:51:54 -08:00
|
|
|
# Determine DESTDIR if not explicitly specified
|
|
|
|
if test -z "$DESTDIR" -a -f ./tools/make_requests; then
|
|
|
|
DESTDIR="$(pwd)"
|
|
|
|
|
|
|
|
elif test ! -f "$DESTDIR/tools/make_requests"; then
|
|
|
|
abort "DESTDIR does not point to the Wine source tree."
|
|
|
|
fi
|
|
|
|
|
2016-08-10 20:54:31 -07:00
|
|
|
# Change directory to DESTDIR, eapply/epatch depends on that
|
2015-01-19 18:54:35 -08:00
|
|
|
if ! cd "$DESTDIR"; then
|
|
|
|
abort "Unable to change directory to $DESTDIR."
|
|
|
|
fi
|
|
|
|
|
2015-05-06 10:29:17 -07:00
|
|
|
# Helper to update configure / the wineserver protocol if required
|
|
|
|
if ! command -v diff >/dev/null 2>&1 ||
|
|
|
|
! command -v grep >/dev/null 2>&1 ||
|
|
|
|
! command -v cmp >/dev/null 2>&1; then
|
|
|
|
|
2015-05-06 13:22:46 -07:00
|
|
|
update_configure()
|
2015-05-06 10:29:17 -07:00
|
|
|
{{
|
|
|
|
autoreconf -f
|
|
|
|
}}
|
|
|
|
|
2015-05-06 13:22:46 -07:00
|
|
|
update_protocol()
|
2015-05-06 10:29:17 -07:00
|
|
|
{{
|
|
|
|
./tools/make_requests
|
|
|
|
}}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
2015-05-06 13:22:46 -07:00
|
|
|
update_configure()
|
2015-05-06 10:29:17 -07:00
|
|
|
{{
|
2015-05-06 13:22:46 -07:00
|
|
|
_file="./configure"
|
2015-05-06 10:29:17 -07:00
|
|
|
|
2015-05-06 13:22:46 -07:00
|
|
|
if ! cp -a "$_file" "$_file.old"; then
|
|
|
|
abort "failed to create $_file.old"
|
2015-05-06 10:29:17 -07:00
|
|
|
fi
|
|
|
|
|
|
|
|
if ! autoreconf -f; then
|
2015-05-06 13:22:46 -07:00
|
|
|
rm "$_file.old"
|
|
|
|
unset _file
|
2015-05-06 10:29:17 -07:00
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Shifting by 62 bits is undefined behaviour when off_t is 32-bit, see also
|
|
|
|
# https://launchpad.net/ubuntu/+source/autoconf/2.69-6 - the bug is still
|
|
|
|
# present in some other distros (including Archlinux).
|
2016-07-01 10:50:22 -07:00
|
|
|
_large_off_old="^#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))\$"
|
2015-05-06 13:22:46 -07:00
|
|
|
_large_off_new="#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))"
|
|
|
|
sed -i'' -e "s|$_large_off_old|$_large_off_new|g" "$_file"
|
|
|
|
unset _large_off_old _large_off_new
|
2015-05-06 10:29:17 -07:00
|
|
|
|
|
|
|
# Restore original timestamp when nothing changed
|
2015-05-06 13:22:46 -07:00
|
|
|
if ! cmp "$_file.old" "$_file" >/dev/null; then
|
|
|
|
rm "$_file.old"
|
2015-05-06 10:29:17 -07:00
|
|
|
else
|
2015-05-06 13:22:46 -07:00
|
|
|
mv "$_file.old" "$_file"
|
2015-05-06 10:29:17 -07:00
|
|
|
fi
|
|
|
|
|
2015-05-06 13:22:46 -07:00
|
|
|
unset _file
|
2015-05-06 10:29:17 -07:00
|
|
|
return 0
|
|
|
|
}}
|
|
|
|
|
2015-05-06 13:22:46 -07:00
|
|
|
update_protocol()
|
2015-05-06 10:29:17 -07:00
|
|
|
{{
|
2015-05-06 13:22:46 -07:00
|
|
|
_file="./include/wine/server_protocol.h"
|
2015-05-06 10:29:17 -07:00
|
|
|
|
2015-05-06 13:22:46 -07:00
|
|
|
if ! cp -a "$_file" "$_file.old"; then
|
|
|
|
abort "failed to create $_file.old"
|
2015-05-06 10:29:17 -07:00
|
|
|
fi
|
|
|
|
|
|
|
|
if ! ./tools/make_requests; then
|
2015-05-06 13:22:46 -07:00
|
|
|
rm "$_file.old"
|
|
|
|
unset _file
|
2015-05-06 10:29:17 -07:00
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Restore original timestamp when nothing changed
|
2015-05-06 13:22:46 -07:00
|
|
|
if diff -u "$_file.old" "$_file" |
|
2015-05-06 10:29:17 -07:00
|
|
|
grep -v "^[+-]#define SERVER_PROTOCOL_VERSION" |
|
|
|
|
grep -v "^\(+++\|---\)" | grep -q "^[+-]"; then
|
2015-05-06 13:22:46 -07:00
|
|
|
rm "$_file.old"
|
2015-05-06 10:29:17 -07:00
|
|
|
else
|
2015-05-06 13:22:46 -07:00
|
|
|
mv "$_file.old" "$_file"
|
2015-05-06 10:29:17 -07:00
|
|
|
fi
|
|
|
|
|
2015-05-06 13:22:46 -07:00
|
|
|
unset _file
|
2015-05-06 10:29:17 -07:00
|
|
|
return 0
|
|
|
|
}}
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2015-01-14 21:51:54 -08:00
|
|
|
# Most backends will try to use git, either directly or indirectly.
|
|
|
|
# Unfortunately this does not work when "$DESTDIR" points to a
|
|
|
|
# subdirectory of a git tree, which has the effect that no patches
|
|
|
|
# are applied, but the exitcode is zero. To avoid broken builds we
|
2017-01-19 01:20:53 -08:00
|
|
|
# will workaround this issue or abort.
|
2015-01-25 16:08:31 -08:00
|
|
|
test ! -d ".git" && git rev-parse --git-dir >/dev/null 2>&1
|
2015-01-14 21:51:54 -08:00
|
|
|
workaround_git_bug="$?"
|
|
|
|
|
2015-01-07 00:49:06 -08:00
|
|
|
# Apply the patches using gitapply.sh, a small wrapper around 'patch'
|
2015-01-10 06:30:31 -08:00
|
|
|
if test "$backend" = "patch"; then
|
2015-01-07 00:49:06 -08:00
|
|
|
|
2015-01-14 21:51:54 -08:00
|
|
|
if test "$workaround_git_bug" -eq 0; then
|
|
|
|
gitapply_args="--nogit"
|
|
|
|
else
|
|
|
|
gitapply_args=""
|
|
|
|
fi
|
|
|
|
|
2015-05-06 10:46:15 -07:00
|
|
|
if test "$enable_autoconf" -gt 1; then
|
|
|
|
warning "Ignoring commandline argument --force-autoconf."
|
|
|
|
enable_autoconf=1
|
|
|
|
fi
|
|
|
|
|
2015-05-06 13:22:46 -07:00
|
|
|
patch_apply_file()
|
2015-01-07 00:49:06 -08:00
|
|
|
{{
|
2017-01-19 01:20:53 -08:00
|
|
|
printf '%s\n' "Applying $1"
|
2015-04-02 12:59:18 -07:00
|
|
|
if ! "$patchdir/gitapply.sh" $gitapply_args < "$1"; then
|
2015-01-07 00:49:06 -08:00
|
|
|
abort "Failed to apply patch, aborting!"
|
|
|
|
fi
|
|
|
|
}}
|
|
|
|
|
2016-08-10 20:54:31 -07:00
|
|
|
# 'eapply/epatch' backend - used on Gentoo
|
|
|
|
elif test "$backend" = "eapply" -o "$backend" = "epatch"; then
|
2015-01-12 04:10:19 -08:00
|
|
|
|
2015-01-14 21:51:54 -08:00
|
|
|
if test "$workaround_git_bug" -eq 0; then
|
|
|
|
gitapply_args="--nogit"
|
|
|
|
else
|
|
|
|
gitapply_args=""
|
|
|
|
fi
|
|
|
|
|
2016-08-10 20:54:31 -07:00
|
|
|
if ! command -v "$backend" >/dev/null 2>&1 || \
|
|
|
|
! command -v ebegin >/dev/null 2>&1 || \
|
|
|
|
! command -v eend >/dev/null 2>&1 || \
|
|
|
|
! command -v nonfatal >/dev/null 2>&1; then
|
|
|
|
abort "Shell functions $backend/ebegin/eend/nonfatal not found. You have to source this script from your ebuild."
|
2015-01-19 18:54:35 -08:00
|
|
|
fi
|
|
|
|
|
2015-05-06 10:46:15 -07:00
|
|
|
if test "$enable_autoconf" -gt 1; then
|
|
|
|
warning "Ignoring commandline argument --force-autoconf."
|
|
|
|
enable_autoconf=1
|
|
|
|
fi
|
|
|
|
|
2015-05-06 13:22:46 -07:00
|
|
|
patch_apply_file()
|
2015-01-12 04:10:19 -08:00
|
|
|
{{
|
2015-05-06 13:22:46 -07:00
|
|
|
_shortname="$(basename "$1")"
|
2015-01-12 04:10:19 -08:00
|
|
|
if grep -q "^GIT binary patch" "$1"; then
|
2015-05-06 13:22:46 -07:00
|
|
|
ebegin "Applying $_shortname"
|
2016-08-10 20:54:31 -07:00
|
|
|
"$patchdir/gitapply.sh" $gitapply_args < "$1"
|
|
|
|
if ! eend $?; then
|
|
|
|
exit 1
|
2015-05-06 10:46:15 -07:00
|
|
|
fi
|
2015-01-12 04:10:19 -08:00
|
|
|
else
|
2016-08-10 20:54:31 -07:00
|
|
|
# we are run from a subshell, so we can't call die
|
|
|
|
if ! nonfatal "$backend" "$1"; then
|
|
|
|
exit 1
|
|
|
|
fi
|
2015-01-12 04:10:19 -08:00
|
|
|
fi
|
2015-05-06 13:22:46 -07:00
|
|
|
unset _shortname
|
2015-01-12 04:10:19 -08:00
|
|
|
}}
|
|
|
|
|
2015-01-07 00:49:06 -08:00
|
|
|
# GIT backend - apply patches using 'git am'
|
2015-01-10 06:30:31 -08:00
|
|
|
elif test "$backend" = "git" -o "$backend" = "git-am"; then
|
2015-01-07 00:49:06 -08:00
|
|
|
|
2015-01-14 21:51:54 -08:00
|
|
|
if test "$workaround_git_bug" -eq 0; then
|
|
|
|
abort "Backend 'git-am' not possible when DESTDIR points to a git subdirectory."
|
|
|
|
fi
|
|
|
|
|
2015-05-06 13:22:46 -07:00
|
|
|
patch_apply_file()
|
2015-01-07 00:49:06 -08:00
|
|
|
{{
|
2017-01-19 01:20:53 -08:00
|
|
|
printf '%s\n' "Applying $1"
|
2015-01-19 18:54:35 -08:00
|
|
|
if ! git am "$1"; then
|
2015-01-07 00:49:06 -08:00
|
|
|
abort "Failed to apply patch, aborting!"
|
|
|
|
fi
|
2015-05-06 10:46:15 -07:00
|
|
|
if test "$enable_autoconf" -gt 1; then
|
2015-05-06 13:22:46 -07:00
|
|
|
_do_commit=0
|
2015-05-06 11:36:56 -07:00
|
|
|
|
|
|
|
# Run 'autoreconf -f' if required
|
|
|
|
if git show --pretty=format: --name-only | grep -q "^\(configure.ac\|aclocal.m4\)$"; then
|
|
|
|
if ! update_configure; then
|
|
|
|
abort "'autoreconf -f' failed."
|
|
|
|
fi
|
|
|
|
git add ./configure
|
|
|
|
git add ./include/config.h.in
|
2015-05-06 13:22:46 -07:00
|
|
|
_do_commit=1
|
2015-05-06 10:46:15 -07:00
|
|
|
fi
|
|
|
|
|
2015-05-06 11:36:56 -07:00
|
|
|
# Run './tools/make_requests' if required
|
|
|
|
if git show --pretty=format: --name-only | grep -q "^server/"; then
|
|
|
|
if ! update_protocol; then
|
|
|
|
abort "'./tools/make_requests' failed."
|
|
|
|
fi
|
|
|
|
git add ./include/wine/server_protocol.h
|
|
|
|
git add ./server/trace.c
|
|
|
|
git add ./server/request.h
|
2015-05-06 13:22:46 -07:00
|
|
|
_do_commit=1
|
2015-05-06 11:36:56 -07:00
|
|
|
fi
|
2015-05-06 10:46:15 -07:00
|
|
|
|
2015-05-06 13:22:46 -07:00
|
|
|
if test "$_do_commit" -ne 0; then
|
2015-05-06 11:36:56 -07:00
|
|
|
if ! git commit --amend --reuse-message HEAD; then
|
|
|
|
abort "Failed to include autogenerated changes in commit."
|
|
|
|
fi
|
2015-05-06 10:46:15 -07:00
|
|
|
fi
|
2015-05-06 13:22:46 -07:00
|
|
|
|
|
|
|
unset _do_commit
|
2015-05-06 10:46:15 -07:00
|
|
|
fi
|
2015-01-07 00:49:06 -08:00
|
|
|
}}
|
|
|
|
|
2015-01-08 05:59:00 -08:00
|
|
|
# Git apply backend
|
2015-01-10 06:30:31 -08:00
|
|
|
elif test "$backend" = "git-apply"; then
|
2015-01-08 05:59:00 -08:00
|
|
|
|
2015-01-14 21:51:54 -08:00
|
|
|
if test "$workaround_git_bug" -eq 0; then
|
|
|
|
abort "Backend 'git-apply' not possible when DESTDIR points to a git subdirectory."
|
|
|
|
fi
|
|
|
|
|
2015-05-06 10:46:15 -07:00
|
|
|
if test "$enable_autoconf" -gt 1; then
|
|
|
|
warning "Ignoring commandline argument --force-autoconf."
|
|
|
|
enable_autoconf=1
|
|
|
|
fi
|
|
|
|
|
2015-05-06 13:22:46 -07:00
|
|
|
patch_apply_file()
|
2015-01-08 05:59:00 -08:00
|
|
|
{{
|
2017-01-19 01:20:53 -08:00
|
|
|
printf '%s\n' "Applying $1"
|
2015-01-19 18:54:35 -08:00
|
|
|
if ! git apply "$1"; then
|
2015-01-08 05:59:00 -08:00
|
|
|
abort "Failed to apply patch, aborting!"
|
|
|
|
fi
|
|
|
|
}}
|
|
|
|
|
2015-01-07 00:49:06 -08:00
|
|
|
# Stacked GIT backend - import the patches (mainly for developers)
|
2015-01-10 06:30:31 -08:00
|
|
|
elif test "$backend" = "stg"; then
|
2015-01-07 00:49:06 -08:00
|
|
|
|
2015-01-14 21:51:54 -08:00
|
|
|
if test "$workaround_git_bug" -eq 0; then
|
|
|
|
abort "Backend 'stg' not possible when DESTDIR points to a git subdirectory."
|
|
|
|
fi
|
|
|
|
|
2015-01-08 06:41:25 -08:00
|
|
|
# Only import the regular patches, no autogenerated ones -
|
|
|
|
# moreover, don't run autoreconf or ./tools/make_requests.
|
2015-01-12 22:54:16 -08:00
|
|
|
enable_patchlist=0
|
|
|
|
enable_autoconf=0
|
2015-01-08 06:41:25 -08:00
|
|
|
|
2015-05-06 13:22:46 -07:00
|
|
|
patch_apply_file()
|
2015-01-08 06:41:25 -08:00
|
|
|
{{
|
2017-01-19 01:20:53 -08:00
|
|
|
printf '%s\n' "Applying $1"
|
2015-05-06 13:22:46 -07:00
|
|
|
_shortname="$(basename "$1")"
|
2017-01-19 01:20:53 -08:00
|
|
|
if ! printf '%s\n' "staging/$_shortname" | cat - "$1" | stg import; then
|
2015-01-08 06:41:25 -08:00
|
|
|
abort "Failed to apply patch, aborting!"
|
|
|
|
fi
|
2015-05-06 13:22:46 -07:00
|
|
|
unset _shortname
|
2015-01-08 06:41:25 -08:00
|
|
|
}}
|
2015-01-07 00:49:06 -08:00
|
|
|
|
|
|
|
else
|
|
|
|
abort "Selected backend $backend not supported."
|
|
|
|
fi
|
|
|
|
|
2015-05-06 13:22:46 -07:00
|
|
|
patch_apply()
|
2015-01-19 18:54:35 -08:00
|
|
|
{{
|
|
|
|
patch_apply_file "$patchdir/$1"
|
|
|
|
}}
|
|
|
|
|
2015-01-07 00:49:06 -08:00
|
|
|
|
|
|
|
{patch_resolver}
|
|
|
|
|
|
|
|
|
|
|
|
# If autoupdate is enabled then create a tempfile to keep track of all patches
|
2015-01-12 22:54:16 -08:00
|
|
|
if test "$enable_patchlist" -eq 1; then
|
2015-01-25 18:46:33 -08:00
|
|
|
if test "$enable_Staging" -eq 1; then
|
2017-06-13 14:54:27 -07:00
|
|
|
# macOS 10.10 and prior do not allow mktemp with empty argument
|
|
|
|
patchlist=$(mktemp 2>/dev/null || mktemp -t tmp)
|
2015-01-25 18:46:33 -08:00
|
|
|
if test ! -f "$patchlist"; then
|
|
|
|
abort "Unable to create temporary file for patchlist."
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
warning "Skipping generation of patchlist because 'Staging' patchset is disabled."
|
|
|
|
enable_patchlist=0
|
2015-01-07 00:49:06 -08:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
{patch_apply}
|
|
|
|
|
|
|
|
|
2015-01-12 22:54:16 -08:00
|
|
|
if test "$enable_patchlist" -eq 1; then
|
2015-01-07 00:49:06 -08:00
|
|
|
|
|
|
|
# Generate a temporary patch containing the patchlist and apply it
|
|
|
|
patch_data=$(cat "$patchlist" | sort)
|
2015-01-10 06:30:31 -08:00
|
|
|
if test ! -z "$patch_data"; then
|
2017-01-19 01:20:53 -08:00
|
|
|
patch_lines=$(printf '%s\n' "$patch_data" | wc -l)
|
2015-01-25 18:46:33 -08:00
|
|
|
patch_lines=$((${{patch_lines}}+21))
|
2015-01-07 00:49:06 -08:00
|
|
|
cat > "$patchlist" <<EOF
|
|
|
|
From: Wine Staging Team <webmaster@fds-team.de>
|
|
|
|
Subject: Autogenerated patch list.
|
|
|
|
|
|
|
|
diff --git a/libs/wine/config.c b/libs/wine/config.c
|
2015-01-25 18:46:33 -08:00
|
|
|
index 5262c76..0a3182f 100644
|
2015-01-07 00:49:06 -08:00
|
|
|
--- a/libs/wine/config.c
|
|
|
|
+++ b/libs/wine/config.c
|
2015-01-25 18:46:33 -08:00
|
|
|
@@ -478,10 +478,${{patch_lines}} @@ const char *wine_get_version(void)
|
2015-01-07 00:49:06 -08:00
|
|
|
return PACKAGE_VERSION;
|
|
|
|
}}
|
|
|
|
|
|
|
|
+static const struct
|
|
|
|
+{{
|
|
|
|
+ const char *author;
|
|
|
|
+ const char *subject;
|
|
|
|
+ int revision;
|
|
|
|
+}}
|
|
|
|
+wine_patch_data[] =
|
|
|
|
+{{
|
|
|
|
${{patch_data}}
|
|
|
|
+ {{ NULL, NULL, 0 }}
|
|
|
|
+}};
|
|
|
|
+
|
2015-01-25 18:46:33 -08:00
|
|
|
/* return the applied non-standard patches */
|
|
|
|
const void *wine_get_patches(void)
|
|
|
|
{{
|
|
|
|
- return NULL;
|
2015-01-07 00:49:06 -08:00
|
|
|
+ return &wine_patch_data[0];
|
2015-01-25 18:46:33 -08:00
|
|
|
}}
|
|
|
|
|
2015-01-07 00:49:06 -08:00
|
|
|
/* return the build id string */
|
|
|
|
EOF
|
2015-01-19 18:54:35 -08:00
|
|
|
patch_apply_file "$patchlist"
|
2015-01-07 00:49:06 -08:00
|
|
|
fi
|
|
|
|
rm "$patchlist"
|
2015-01-12 22:54:16 -08:00
|
|
|
fi
|
2015-01-07 00:49:06 -08:00
|
|
|
|
2015-01-12 22:54:16 -08:00
|
|
|
if test "$enable_autoconf" -eq 1; then
|
2015-05-06 10:46:15 -07:00
|
|
|
if ! update_configure; then
|
|
|
|
abort "'autoreconf -f' failed."
|
|
|
|
fi
|
|
|
|
if ! update_protocol; then
|
|
|
|
abort "'./tools/make_requests' failed."
|
|
|
|
fi
|
2015-01-07 00:49:06 -08:00
|
|
|
fi
|
|
|
|
# Success
|
|
|
|
exit 0
|