Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Maintainer: BieHDC <[email protected]>
- pkgname=wine-staging #>FIXME: replace it for now
- pkgrel=1
- pkgdesc="A compatibility layer for running Windows programs - Custom Staging branch"
- url="http://www.wine-staging.com"
- arch=(x86_64) #No 32-bit version here
- options=(staticlibs !strip) #dont strip for debug reasons
- license=(LGPL)
- conflicts=('wine' 'wine-wow64') ##FIXME: fix this if we not replace wine-staging
- _depends=(
- attr lib32-attr
- fontconfig lib32-fontconfig
- lcms2 lib32-lcms2
- libxml2 lib32-libxml2
- libxcursor lib32-libxcursor
- libxrandr lib32-libxrandr
- libxdamage lib32-libxdamage
- libxi lib32-libxi
- gettext lib32-gettext
- freetype2 lib32-freetype2
- glu lib32-glu
- libsm lib32-libsm
- gcc-libs lib32-gcc-libs
- libpcap lib32-libpcap
- desktop-file-utils
- )
- makedepends=(autoconf ncurses bison perl fontforge flex
- 'gcc>=4.5.0-2' # 'gcc-multilib>=4.5.0-2' merged into gcc?
- giflib lib32-giflib
- libpng lib32-libpng
- gnutls lib32-gnutls
- libxinerama lib32-libxinerama
- libxcomposite lib32-libxcomposite
- libxmu lib32-libxmu
- libxxf86vm lib32-libxxf86vm
- libldap lib32-libldap
- mpg123 lib32-mpg123
- openal lib32-openal
- v4l-utils lib32-v4l-utils
- alsa-lib lib32-alsa-lib
- libxcomposite lib32-libxcomposite
- mesa lib32-mesa
- mesa-libgl lib32-mesa-libgl
- opencl-icd-loader lib32-opencl-icd-loader
- libxslt lib32-libxslt
- libpulse lib32-libpulse
- libva lib32-libva
- gtk3 lib32-gtk3
- gst-plugins-base-libs lib32-gst-plugins-base-libs
- samba
- opencl-headers
- )
- optdepends=(
- giflib lib32-giflib
- libpng lib32-libpng
- libldap lib32-libldap
- gnutls lib32-gnutls
- mpg123 lib32-mpg123
- openal lib32-openal
- v4l-utils lib32-v4l-utils
- libpulse lib32-libpulse
- alsa-plugins lib32-alsa-plugins
- alsa-lib lib32-alsa-lib
- libjpeg-turbo lib32-libjpeg-turbo
- libxcomposite lib32-libxcomposite
- libxinerama lib32-libxinerama
- ncurses lib32-ncurses
- opencl-icd-loader lib32-opencl-icd-loader
- libxslt lib32-libxslt
- libva lib32-libva
- gtk3 lib32-gtk3
- gst-plugins-base-libs lib32-gst-plugins-base-libs
- vulkan-icd-loader lib32-vulkan-icd-loader
- cups
- samba dosbox
- )
- makedepends=(${makedepends[@]} ${_depends[@]})
- #########################
- #####FUN BEGINS HERE#####
- #########################
- #If you know how to improve it or you find bugs etc. please let me know
- #In case of adding features, well, we can talk about it ;)
- #NEEDS_TESTING: rebase should also check out newer versions
- #USE_MODE="preserve" #preserve custom changes
- USE_MODE="rebase" #make a clean build/delete changes made to the source code - Default
- #USE_MODE="refresh" #delete old build files, redownload wine - use this when you want the newest wine-staging version
- #true/false switch, very useful between a new wine release and staging hasn't cought up yet --UNSTABLE
- OVERRIDE_VERSION="true"
- #set this to your desired version/when not in use, set this to the current version or your package reports the wrong wine version
- pkgver=2.21
- provides=("wine=$pkgver" "wine-wow64=$pkgver") #ignore this
- prepare() {
- #Delete everything on refresh
- if [ $USE_MODE == "refresh" ]; then
- if [ -d "build_wine64" ]; then rm -Rf "build_wine64"; fi
- if [ -d "build_wine32" ]; then rm -Rf "build_wine32"; fi
- if [ -d "wine" ] ; then rm -Rf "wine" ; fi
- if [ -d "wine-staging" ]; then rm -Rf "wine-staging"; fi
- fi
- #Get sources for wine
- if [ ! -d "wine" ]; then #refresh
- git clone git://source.winehq.org/git/wine.git
- cd wine
- if [ $OVERRIDE_VERSION == "true" ]; then
- git checkout tags/wine-$pkgver
- else
- git checkout tags/$(git describe --abbrev=0 --tags)
- pkgver=$(git describe --abbrev=0 --tags)
- pkgver=${pkgver/wine-/}
- fi
- cd ..
- elif [ $USE_MODE == "rebase" ]; then
- cd wine
- git clean -fd #clean the repo
- git reset --hard HEAD #Reset
- git checkout master
- git fetch --all #this should fix parsing new tags
- if [ $OVERRIDE_VERSION == "true" ]; then
- git checkout tags/wine-$pkgver
- else
- git checkout tags/$(git describe --abbrev=0 --tags)
- pkgver=$(git describe --abbrev=0 --tags)
- pkgver=${pkgver/wine-/}
- fi
- if [ -f "wine_staging_patched" ]; then rm wine_staging_patched; fi #we need to re-apply the patches
- cd ..
- else
- cd wine
- pkgver=$(git describe --abbrev=0 --tags)
- cd ..
- fi
- #Get sources for wine-staging
- if [ ! -d "wine-staging" ]; then #refresh
- git clone https://github.com/wine-compholio/wine-staging
- cd wine-staging
- if [ $OVERRIDE_VERSION == "true" ]; then
- git checkout tags/v$pkgver
- else
- git checkout tags/$(git describe --abbrev=0 --tags)
- fi
- cd ..
- elif [ $USE_MODE == "rebase" ]; then
- cd wine-staging
- git clean -fd #clean the repo
- git reset --hard HEAD #Reset
- git checkout master
- git fetch --all #this should fix parsing new tags
- if [ $OVERRIDE_VERSION == "true" ]; then
- git checkout tags/v$pkgver
- else
- git checkout tags/$(git describe --abbrev=0 --tags)
- fi
- cd ..
- fi
- if [ ! -f "wine/wine_staging_patched" ]; then #if the patches have not been applied
- #Apply staging patches
- ./wine-staging/patches/patchinstall.sh DESTDIR="wine" --all
- #Set the flag that we have patched
- touch "wine/wine_staging_patched"
- fi
- #https://bugs.winehq.org/show_bug.cgi?id=43530
- export CFLAGS="${CFLAGS/-fno-plt/}"
- export LDFLAGS="${LDFLAGS/,-z,now/}"
- sed 's|OpenCL/opencl.h|CL/opencl.h|g' -i wine/configure*
- #Create build dirs if they dont exist
- if [ ! -d "build_wine64" ]; then mkdir build_wine64; fi
- if [ ! -d "build_wine32" ]; then mkdir build_wine32; fi
- }
- build() {
- #Apply our custom patch files
- #Place patch files in the patches dir
- cd ..
- #if we have reset our repo, simple clean the file
- if [ $USE_MODE != "preserve" ]; then
- if [ -f "patches_applied" ]; then rm patches_applied; fi
- fi
- #create the file if it does not exist
- if [ ! -f "patches_applied" ]; then
- touch patches_applied
- fi
- #load already applied patches from the file into an array
- appliedPatches=()
- while IFS= read -r line
- do
- appliedPatches+=("$line")
- done < "patches_applied"
- if [ "$(ls -A patches/)" ]; then #if there are patches to apply
- #compare files inside patches dir against our already applied patches
- for f in patches/*
- do
- if [[ ! " ${appliedPatches[@]} " =~ " ${f} " ]]; then #if patch has not been applied
- echo $f
- cd src/wine/
- patch --ignore-whitespace -p1 < "$srcdir/../$f"
- cd ../../
- echo "$f" >> patches_applied #add the patch into our applied list
- else
- echo Skipping $f #skip the file if already applied
- fi
- done
- fi
- #Nothing to do for you after this line ;)
- #Except you can change -j4 to the amount of processor cores you want to work eg -j7
- #Apply the generated .pkg.tar file with "sudo pacman -U FILENAME.pkg.tar"
- cd src/wine
- msg2 "Building Wine-64..."
- cd "$srcdir/build_wine64"
- ../wine/configure \
- --prefix=/usr \
- --libdir=/usr/lib \
- --with-x \
- --with-gstreamer \
- --enable-win64 \
- --with-xattr
- make -j4
- export PKG_CONFIG_PATH="/usr/lib32/pkgconfig"
- msg2 "Building Wine-32..."
- cd "$srcdir/build_wine32"
- ../wine/configure \
- --prefix=/usr \
- --libdir=/usr/lib32 \
- --with-x \
- --with-gstreamer \
- --with-xattr \
- --with-wine64="../build_wine64"
- make -j4
- }
- package() {
- msg2 "Packaging Wine-32..."
- cd "$srcdir/build_wine32"
- make prefix="$pkgdir/usr" \
- libdir="$pkgdir/usr/lib32" \
- dlldir="$pkgdir/usr/lib32/wine" install
- msg2 "Packaging Wine-64..."
- cd "$srcdir/build_wine64"
- make prefix="$pkgdir/usr" \
- libdir="$pkgdir/usr/lib" \
- dlldir="$pkgdir/usr/lib/wine" install
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement