From 3d628de14a76d98e164cb3095ad3691170c8231d Mon Sep 17 00:00:00 2001 From: iFoundSilentHouse Date: Sun, 21 Apr 2024 01:45:17 +0600 Subject: [PATCH] wine: add aarch64 packaging --- srcpkgs/wine/template | 83 +++++++++++++++++++++++++++++++------------ 1 file changed, 60 insertions(+), 23 deletions(-) diff --git a/srcpkgs/wine/template b/srcpkgs/wine/template index 0e2b07d222c1e0..00142380d05fc6 100644 --- a/srcpkgs/wine/template +++ b/srcpkgs/wine/template @@ -1,7 +1,7 @@ # Template file for 'wine' pkgname=wine version=9.6 -revision=1 +revision=2 _pkgver=${version/r/-r} create_wrksrc=yes build_wrksrc=wine-${_pkgver} @@ -21,12 +21,18 @@ checksum="0e0960ed82b6017e882eda3338bad1270a1177b6cf05f03ac1fab155abe82048 build_options="mingw staging xshm" build_options_default="mingw xshm" +case "$XBPS_TARGET_MACHINE" in + aarch64*) + build_options="staging xshm" + build_options_default="xshm" +esac + desc_option_mingw="Use the MinGW cross compiler to build WinPE DLLs" desc_option_staging="Apply the wine-staging patchset" desc_option_xshm="Enable support for the X Shared Memory Extension" lib32mode=full -archs="i686* x86_64*" +archs="i686* x86_64* aarch64*" patch_args="-Np1 --directory=${build_wrksrc}" @@ -49,7 +55,7 @@ makedepends="gettext-devel ncurses-devel glu-devel libSM-devel freetype-devel pulseaudio-devel giflib-devel v4l-utils-devel fontconfig-devel gnutls-devel dbus-devel sane-devel libpcap-devel cups-devel ocl-icd-devel vulkan-loader gst-plugins-base1-devel - SDL2-devel" + SDL2-devel wayland-devel" depends="libXi libXinerama libXcomposite libXcursor libOSMesa desktop-file-utils hicolor-icon-theme liberation-fonts-ttf gnutls SDL2 wine-common>=${version}_${revision}" @@ -61,8 +67,14 @@ replaces="libwine>=0" # This testsuite might hang indefinitely make_check=extended +case "$XBPS_MACHINE" in + aarch64*) no_cross=yes # TODO: testing +esac + + if [ "$XBPS_TARGET_WORDSIZE" != 32 ]; then - configure_args+=" --enable-win64 --libdir=/usr/lib" + _64bit_configure_args=" --enable-win64 --libdir=/usr/lib" + configure_args+=_64bit_configure_args _wine_suffix="64" _wineserver_suffix=${_wine_suffix} else @@ -70,11 +82,25 @@ else CFLAGS=" -D_LARGE_FILE_SOURCE=1 -D_FILE_OFFSET_BITS=64" fi +if [ "$CROSS_BUILD" ] && [ $(vopt_if mingw true false) ]; then + hostmakedepends+=" ${makedepends} lld clang llvm17" + pre_configure() { + # native compilation for wine-tools + vsrcextract -C ../wine-tools-for-cross wine-${_pkgver}.tar.xz + cd ../wine-tools-for-cross + env CC=cc LD=ld CXX=g++ \ + CFLAGS="" CXXFLAGS="" LDFLAGS="" \ + ./configure $_64bit_configure_args # not set if 32bit + make ${makejobs} + configure_args+=" --with-wine-tools=../wine-tools-for-cross" + } +fi + if [ "$XBPS_LIBC" = "glibc" ]; then hostmakedepends+=" prelink" fi -if [ "$XBPS_TARGET_LIBC" = "musl" ]; then +if [ "$XBPS_TARGET_LIBC" = "musl" ] && [ "$XBPS_TARGET_MACHINE" != aarch64-musl ]; then configure_args+=" --enable-archs=i386,x86_64" makedepends+=" cross-i686-w64-mingw32" fi @@ -113,12 +139,21 @@ post_install() { mv ${DESTDIR}${_wine_libexec}/wineserver ${DESTDIR}${_wine_libexec}/wineserver${_wineserver_suffix} vbin ${FILESDIR}/wine vbin ${FILESDIR}/wineserver - for file in msiexec regedit regsvr32 wineboot winecfg winepath winemine winefile \ - winedbg wineconsole notepad msidb widl winebuild winecpp winedump wineg++ \ - winegcc winemaker wmc wrc function_grep.pl - do - mv ${DESTDIR}/usr/libexec/wine/${file} ${DESTDIR}/usr/bin/ - done + if [ "$CROSS_BUILD" ] && [ $(vopt_if mingw true false) ]; then + # do not install wine-tools for target - they were not compiled + for file in msiexec regedit regsvr32 wineboot winecfg winepath winemine winefile \ + winedbg wineconsole notepad msidb + do + mv ${DESTDIR}/usr/libexec/wine/${file} ${DESTDIR}/usr/bin/ + done + else + for file in msiexec regedit regsvr32 wineboot winecfg winepath winemine winefile \ + winedbg wineconsole notepad msidb widl winebuild winecpp winedump wineg++ \ + winegcc winemaker wmc wrc function_grep.pl + do + mv ${DESTDIR}/usr/libexec/wine/${file} ${DESTDIR}/usr/bin/ + done + fi case $XBPS_TARGET_MACHINE in x86_64*) ln -s ${_wine_libexec}/wine64 ${DESTDIR}/usr/bin/wine64 @@ -152,16 +187,18 @@ wine-common_package() { } } -wine-tools_package() { - depends="wine-${version}_${revision}" - short_desc+=" - development tools" - if [ "${_nopie}" = yes ]; then - nopie=yes - fi - pkg_install() { - for file in widl winebuild winecpp winedump wineg++ winegcc winemaker wmc wrc function_grep.pl - do - vmove usr/bin/${file} - done +if [ ! "$CROSS_BUILD" ] && [ ! $(vopt_if mingw true false)]; then + wine-tools_package() { + depends="wine-${version}_${revision}" + short_desc+=" - development tools" + if [ "${_nopie}" = yes ]; then + nopie=yes + fi + pkg_install() { + for file in widl winebuild winecpp winedump wineg++ winegcc winemaker wmc wrc function_grep.pl + do + vmove usr/bin/${file} + done + } } -} +fi