From d3ba98925406aa6e875477c8690075f9ce1c9a14 Mon Sep 17 00:00:00 2001 From: Rinaldus Date: Sat, 24 Oct 2020 14:03:14 +0300 Subject: [PATCH] Initial commit --- README.md | 11 ++++++++ wine_build.sh | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 README.md create mode 100755 wine_build.sh diff --git a/README.md b/README.md new file mode 100644 index 0000000..6dddb55 --- /dev/null +++ b/README.md @@ -0,0 +1,11 @@ +You can compile almost any* version of vanilla wine or wine-staging. +# Instructions +1. Clone this repository to any directory. Open `wine_build.sh` in text editor and change `WORKDIR` and `MAKEOPTS` variables. +2. Make the script executable + `chmod +x wine_build.sh` +3. Launch the script with wine version number as parameter. For example: + `./wine_build.sh 5.20` + After script work is finished, you can find .tar.gz archive with your build in `WORKDIR/install/` +# Disclaimer +You can't build stable (.0) wine versions with this script because of different source paths for stable (e.g 5.0) and unstable (e.g 5.x) versions. +*I don't gurantee that this script can build any old wine version with this script. I don't care about it. I care about only latest wine major branch. diff --git a/wine_build.sh b/wine_build.sh new file mode 100755 index 0000000..ecf9816 --- /dev/null +++ b/wine_build.sh @@ -0,0 +1,75 @@ +#!/bin/bash + +if [ -z $1 ]; then + echo "You had to input Wine version." + exit 0 +fi + +# The directory where wine compiles +WORKDIR="/home/rinaldus/Мастерская/wine" +# Number of CPU cores +1 (e.g, if you have 8 cores CPU, you have to set -j9) +MAKEOPTS="-j9" +# You can change wine build flags if you need +BUILD_FLAGS="--with-x --without-gstreamer" + +#do not modify these variables +WINE_NAME="wine-$1" +ARCHIVE_NAME="wine-$1.tar.xz" +BRANCH_VERSION="`echo $1 | awk 'BEGIN {FS="."}{print $1".x"}' | awk 'BEGIN {FS="-"}{print $1}'`" +SRC_URL="https://dl.winehq.org/wine/source/$BRANCH_VERSION/$ARCHIVE_NAME" + +# Delete all necessary directories if they are already exist +rm -rf "$WORKDIR/src/$WINE_NAME" +rm -rf "$WORKDIR/build/$WINE_NAME" +rm -rf "$WORKDIR/install/$WINE_NAME" + +# Create necessary directories +mkdir -p "$WORKDIR/src" +mkdir -p "$WORKDIR/build/$WINE_NAME/wine64" +mkdir -p "$WORKDIR/build/$WINE_NAME/wine32" +mkdir -p "$WORKDIR/install" + +echo "Which version of Wine we are going to build?" +echo "1. Staging (Wine + several useful patches)" +echo "2. Vanilla (original version)" +echo "Choose one variant (1 or 2)" +read KEYPRESS +case $KEYPRESS in + "1" ) + STAGING_NAME="wine-staging-$1" + STAGING_ARCHIVE_NAME="v$1.tar.gz" + BUILD_NAME=$STAGING_NAME + STAGING_SRC_URL="https://github.com/wine-staging/wine-staging/archive/$STAGING_ARCHIVE_NAME" + + cd "$WORKDIR/src" + wget "$SRC_URL" + tar xvJf $ARCHIVE_NAME + wget "$STAGING_SRC_URL" + tar xvf $STAGING_ARCHIVE_NAME + "$WORKDIR/src/$STAGING_NAME/patches/patchinstall.sh" DESTDIR="$WORKDIR/src/$WINE_NAME" --all + ;; + "2" ) + BUILD_NAME=$WINE_NAME + + cd "$WORKDIR/src" + wget "$SRC_URL" + tar xvJf $ARCHIVE_NAME + ;; +esac + +# Configure and build Wine64 +cd "$WORKDIR/build/$WINE_NAME/wine64" +"$WORKDIR/src/$WINE_NAME/configure" $BULD_FLAGS --enable-win64 --prefix="$WORKDIR/install/$BUILD_NAME" && make depend && make $MAKEOPTS && make install + +# Configure and build Wine32 +cd "$WORKDIR/build/$WINE_NAME/wine32" +"$WORKDIR/src/$WINE_NAME/configure" $BUILD_FLAGS --prefix="$WORKDIR/install/$BUILD_NAME" --with-wine64=../wine64 && make depend && make $MAKEOPTS && make install + +# Pack installed Wine to archive +cd "$WORKDIR/install" +tar -zcvf $BUILD_NAME.tar.gz $BUILD_NAME + +# Cleaning +rm -rf "$WORKDIR/src" +rm -rf "$WORKDIR/build" +rm -rf "$WORKDIR/install/$BUILD_NAME"