emulators/wine8: New port, cloning emulators/wine

Wine 9 has been released some weeks ago and it's time to upgrade the
main emulators/wine port. However, there may be some regressions (in
particular around WoW64), so create emulators/wine8 as a clone of the
state before the version upgrade as a fallback. [1]

Since it is rarely, if ever, used, in particular in this context,
remove the MONO option.

Discussed with:	Lexi Winter <lexi@le-fay.org> [1]
This commit is contained in:
Gerald Pfeifer 2024-03-03 13:58:35 +00:00
parent 444305fa35
commit 5aa9792e66
11 changed files with 2938 additions and 0 deletions

View File

@ -172,6 +172,7 @@
SUBDIR += wine-mono
SUBDIR += wine-mono-devel
SUBDIR += wine-proton
SUBDIR += wine8
SUBDIR += winetricks
SUBDIR += x16-emulator
SUBDIR += x16-rom

163
emulators/wine8/Makefile Normal file
View File

@ -0,0 +1,163 @@
PORTNAME= wine
DISTVERSION= 8.0.2
CATEGORIES= emulators
MASTER_SITES= https://dl.winehq.org/wine/source/8.0/
PKGNAMESUFFIX= 8
MAINTAINER= gerald@FreeBSD.org
COMMENT= Microsoft Windows compatibility environment
WWW= https://www.winehq.org
LICENSE= LGPL21 LGPL3
LICENSE_COMB= dual
LICENSE_FILE= ${WRKSRC}/LICENSE
ONLY_FOR_ARCHS= amd64 i386
BUILD_DEPENDS= ${LOCALBASE}/bin/flex:textproc/flex llvm${_LLVM_VERSION}>=0:devel/llvm${_LLVM_VERSION}
USES= bison cpe desktop-file-utils gmake localbase \
pkgconfig sdl shebangfix tar:xz
USE_GCC= yes
USE_SDL= sdl2
CPE_VENDOR= winehq
CONFLICTS_INSTALL= wine-devel
GNU_CONFIGURE= yes
CONFIGURE_ARGS+=--verbose \
--disable-kerberos \
--disable-tests \
--without-capi \
--without-coreaudio \
--without-dbus \
--without-gettext --without-gettextpo \
--without-gphoto \
--without-gssapi \
--without-gstreamer \
--without-inotify \
--without-krb5 \
--with-mingw CROSSCC="clang" CROSSCFLAGS="-isystem ${FILESDIR}/clang" \
--without-netapi \
--without-opencl \
--without-osmesa \
--with-pcap \
--with-pthread \
--without-pulse \
--without-sane \
--with-sdl \
--without-udev \
--without-unwind \
--without-usb
CONFIGURE_ENV= CPPBIN="${CPP}" FLEX="${LOCALBASE}/bin/flex"
WINELIBDIR= ${PREFIX}/lib
.if !defined(USE_LDCONFIG32)
USE_LDCONFIG= ${WINELIBDIR} ${WINELIBDIR}/wine
.endif
SHEBANG_FILES= tools/make_requests tools/winemaker/winemaker \
tools/winedump/function_grep.pl
BINARY_ALIAS+= clang=${LOCALBASE}/bin/clang${_LLVM_VERSION} \
lld-link=${LOCALBASE}/bin/lld-link${_LLVM_VERSION}
SUB_FILES= pkg-message
PORTDATA= wine.inf
OPTIONS_DEFINE= CUPS DOCS DOSBOX GNUTLS V4L WINEMAKER X11 GECKO
OPTIONS_DEFAULT=ALSA GNUTLS X11
OPTIONS_RADIO= AUDIO
OPTIONS_RADIO_AUDIO= ALSA OSS
OPTIONS_SUB= yes
DOSBOX_DESC= Use DOSBox to run MS-DOS programs
WINEMAKER_DESC= Fully support winemaker (requires Perl)
GECKO_DESC= Bundle Gecko MSI package for Wine
PORTSCOUT= limit:^8\.0
ALSA_CONFIGURE_WITH= alsa
ALSA_LIB_DEPENDS= libasound.so:audio/alsa-lib
ALSA_RUN_DEPENDS= alsa-plugins>0:audio/alsa-plugins
CUPS_CONFIGURE_WITH= cups
CUPS_LIB_DEPENDS= libcups.so:print/cups
DOSBOX_RUN_DEPENDS= dosbox:emulators/dosbox
GECKO_RUN_DEPENDS= wine-gecko>0:emulators/wine-gecko
GNUTLS_CONFIGURE_WITH= gnutls
GNUTLS_LIB_DEPENDS= libgnutls.so:security/gnutls
OSS_CONFIGURE_WITH= oss
V4L_CONFIGURE_WITH= v4l2
V4L_BUILD_DEPENDS= ${LOCALBASE}/include/linux/videodev2.h:multimedia/v4l_compat
V4L_LIB_DEPENDS= libv4l2.so:multimedia/libv4l
WINEMAKER_RUN_DEPENDS= p5-XML-LibXML>0:textproc/p5-XML-LibXML
X11_CONFIGURE_WITH= x fontconfig freetype opengl xinerama xinput2 xrandr xrender
X11_USES= gl xorg
X11_USE= GL=glu XORG=x11,xext,xcomposite,xcursor,xi,xinerama,xrandr,xrender
X11_LIB_DEPENDS= libfontconfig.so:x11-fonts/fontconfig \
libfreetype.so:print/freetype2 \
libvulkan.so:graphics/vulkan-loader
.include <bsd.port.pre.mk>
.if (${LLVM_DEFAULT} == 10 || ${LLVM_DEFAULT} == 11)
_LLVM_VERSION= 15
.else
_LLVM_VERSION= ${LLVM_DEFAULT}
.endif
.if ${ARCH} == amd64
# Wine is composed of three parts:
# - wine (aka this port on FreeBSD/i386) is the 32-bit component
# and runs 32-bit programs.
# - wine64 (aka this part of this port on FreeBSD/amd64) is the
# 64-bit component and runs 64-bit programs.
# - wow64 (aka this port built on FreeBSD/i386) is a part of the
# 64-bit component [wine64] that runs 32-bit programs on FreeBSD/amd64.
# --libdir is required since Wine defaults to "${PREFIX}/lib64" on amd64.
CONFIGURE_ARGS+= --enable-win64 --libdir=${PREFIX}/lib
PLIST_SUB+= WINE32="@comment " WINE64="" WINEARCH="x86_64"
# Wine assumes a WoW64 package is available, which is not the case on
# FreeBSD yet.
post-patch:
${REINPLACE_CMD} '/Exec/s|wine|wine64|g' ${WRKSRC}/loader/wine.desktop
.else
PLIST_SUB+= WINE32="" WINE64="@comment " WINEARCH="i386"
.endif
pre-build:
cd ${WRKSRC} && ${MAKE_CMD} depend
post-install:
.if ${ARCH} == i386
${MV} ${STAGEDIR}${PREFIX}/bin/wineserver ${STAGEDIR}${PREFIX}/bin/wineserver32
${MV} ${STAGEDIR}${PREFIX}/bin/wine ${STAGEDIR}${PREFIX}/bin/wine.bin
-${ELFCTL} -e +noaslr ${STAGEDIR}${PREFIX}/bin/wine.bin
${INSTALL_SCRIPT} ${FILESDIR}/wine.sh ${STAGEDIR}${PREFIX}/bin/wine
.else
${MV} ${STAGEDIR}${PREFIX}/bin/wine64 ${STAGEDIR}${PREFIX}/bin/wine64.bin
-${ELFCTL} -e +noaslr ${STAGEDIR}${PREFIX}/bin/wine64.bin
${INSTALL_SCRIPT} ${FILESDIR}/wine.sh ${STAGEDIR}${PREFIX}/bin/wine64
${INSTALL_SCRIPT} ${FILESDIR}/wine-wow64.sh ${STAGEDIR}${PREFIX}/bin/wine
${INSTALL_SCRIPT} ${FILESDIR}/pkg32.sh ${STAGEDIR}${DATADIR}/pkg32.sh
.endif
@${MKDIR} ${STAGEDIR}${DOCSDIR}
.for i in README ANNOUNCE AUTHORS
${INSTALL_DATA} ${WRKSRC}/${i} ${STAGEDIR}${DOCSDIR}
.endfor
${INSTALL_DATA} ${WRKSRC}/programs/winedbg/README ${STAGEDIR}${DOCSDIR}/README.winedbg
${INSTALL_DATA} ${WRKSRC}/tools/winedump/README ${STAGEDIR}${DOCSDIR}/README.winedump
.include <bsd.port.post.mk>

3
emulators/wine8/distinfo Normal file
View File

@ -0,0 +1,3 @@
TIMESTAMP = 1691940152
SHA256 (wine-8.0.2.tar.xz) = 6ec8fb6f2c72d576cb11f52b2f8d59af64404802154651d122b98466d91dc847
SIZE (wine-8.0.2.tar.xz) = 29060452

View File

@ -0,0 +1,12 @@
--- UTC
--- configure.orig 2023-02-02 21:17:09.000000000 +0000
+++ configure 2023-05-01 21:19:03.739461000 +0000
@@ -10696,7 +10696,7 @@
fi
llvm_extra_cflags="-target $llvm_target -fuse-ld=lld"
case $llvm_target in
- *windows) llvm_cflags="-Wl,-subsystem:console -Wl,-WX" ;;
+ *windows) llvm_cflags="-Wl,-subsystem:console" ;;
esac
{ as_ac_var=`printf "%s\n" "ac_cv_${wine_arch}_cflags_$llvm_extra_cflags $llvm_cflags" | $as_tr_sh`
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC supports $llvm_extra_cflags $llvm_cflags" >&5

View File

@ -0,0 +1,24 @@
--- dlls/ntdll/unix/loader.c.orig 2023-07-19 15:29:22 UTC
+++ dlls/ntdll/unix/loader.c
@@ -694,6 +694,21 @@ static NTSTATUS loader_exec( char **argv, WORD machine
{
if (machine != current_machine)
{
+ char* wineserver_path = getenv("WINESERVER");
+ if (wineserver_path != NULL && wineserver_path[0] == '/') {
+ char* s = remove_tail(wineserver_path, "server");
+ if (s != NULL) {
+ if (machine == IMAGE_FILE_MACHINE_AMD64) {
+ argv[1] = malloc(strlen(s) + 3);
+ strcpy(argv[1], s);
+ strcat(argv[1], "64");
+ } else {
+ argv[1] = s;
+ }
+ preloader_exec(argv);
+ }
+ }
+
if (machine == IMAGE_FILE_MACHINE_AMD64) /* try the 64-bit loader */
{
size_t len = strlen(wineloader);

View File

@ -0,0 +1,13 @@
[
{ type: install
message: <<EOM
Some ZFS tuning guides recommend setting KVA_PAGES=512 in your kernel
configuration. This is incompatible with Wine. The maximum possible
is KVA_PAGES=500, which should still be enough for ZFS.
The port also installs some of Wine's documentation which describes
additional programs that are not in the manual pages under
%%PREFIX%%/share/doc/wine
EOM
}
]

View File

@ -0,0 +1,20 @@
#!/bin/sh -e
if [ "$(id -u)" = 0 ]
then
echo "Don't run this script as root!"
exit 1
fi
I386_ROOT="${WINE_i386_ROOT:-$HOME/.i386-wine-pkg}"
if [ ! -d "$I386_ROOT/usr/share/keys/pkg" ]
then
mkdir -p "$I386_ROOT/usr/share/keys"
ln -s /usr/share/keys/pkg "$I386_ROOT/usr/share/keys/pkg"
fi
ABI=$(pkg config ABI | sed s/amd64/i386/)
# Show what we're going to do, then do it.
echo pkg -o ABI="$ABI" -o INSTALL_AS_USER=true -o RUN_SCRIPTS=false --rootdir "$I386_ROOT" "$@"
exec pkg -o ABI="$ABI" -o INSTALL_AS_USER=true -o RUN_SCRIPTS=false --rootdir "$I386_ROOT" "$@"

View File

@ -0,0 +1,59 @@
#!/bin/sh -e
TARGET="$(realpath "$0")"
PREFIX="${TARGET%/*/*}"
LOCALBASE="${PREFIX}"
I386_ROOT="${WINE_i386_ROOT:-$HOME/.i386-wine-pkg}"
if [ ! -f "$I386_ROOT/$PREFIX/bin/wine" ]
then
printf "%s doesn't exist!\n\n" "$I386_ROOT/$PREFIX/bin/wine"
printf "Try installing 32-bit Wine with\n\t%s\n" "$PREFIX/share/wine/pkg32.sh install wine8 mesa-dri"
ABI=$(pkg config ABI | sed s/amd64/i386/)
FREEBSD_VERSION_MAJOR=`uname -r | sed "s/\..*//"`
cat <<- HERE
If using Poudriere, please make sure your repo is setup to use ${ABI}
and create symlinks for
FreeBSD:$FREEBSD_VERSION_MAJOR:amd64 and
FreeBSD:$FREEBSD_VERSION_MAJOR:i386
to the relevant output directories. See pkg.conf(5) for more info.
HERE
exit 1
fi
WINE32_VERSION=$(env -u WINELOADERNOEXEC "$I386_ROOT/$PREFIX/bin/wine" --version)
WINE64_VERSION=$(env -u WINELOADERNOEXEC "${TARGET}64" --version)
if [ "$WINE32_VERSION" != "$WINE64_VERSION" ]
then
printf "wine [%s] and wine64 [%s] versions do not match!\n\n" "$WINE32_VERSION" "$WINE64_VERSION"
printf "Try updating 32-bit wine with\n\t%s\n" "$PREFIX/share/wine/pkg32.sh upgrade"
exit 1
fi
export LIBGL_DRIVERS_PATH="${LIBGL_DRIVERS_PATH:+$LIBGL_DRIVERS_PATH:}$LOCALBASE/lib/dri-devel:$LOCALBASE/lib32/dri-devel:$I386_ROOT/$LOCALBASE/lib/dri-devel:$LOCALBASE/lib/dri:$LOCALBASE/lib32/dri:$I386_ROOT/$LOCALBASE/lib/dri"
export LD_32_LIBRARY_PATH="${LD_32_LIBRARY_PATH:+$LD_32_LIBRARY_PATH:}$I386_ROOT/$PREFIX/lib/wine:$LOCALBASE/lib32:$I386_ROOT/$LOCALBASE/lib"
for d in "$I386_ROOT/$LOCALBASE"/llvm*/lib
do
if [ -d "$d" ]
then
export LD_32_LIBRARY_PATH="$LD_32_LIBRARY_PATH:$d"
fi
done
export LD_32_LIBRARY_PATH_RPATH=y
LD_32_LIBMAP_CONF=$(sed "s,$LOCALBASE,$I386_ROOT&,2" "$I386_ROOT/$LOCALBASE"/etc/libmap.d/*.conf 2>/dev/null || true)
export LD_32_LIBMAP="
libgcc_s.so.1 /usr/lib32/libgcc_s.so.1
$LOCALBASE/lib/libvulkan_intel.so $I386_ROOT/$LOCALBASE/lib/libvulkan_intel.so
$LOCALBASE/lib/libvulkan_radeon.so $I386_ROOT/$LOCALBASE/lib/libvulkan_radeon.so
$LOCALBASE/lib/alsa-lib/libasound_module_pcm_oss.so $I386_ROOT/$LOCALBASE/lib/alsa-lib/libasound_module_pcm_oss.so
$LD_32_LIBMAP_CONF
$LD_32_LIBMAP"
if [ -z "$WINE_NO_WOW64" ]
then
export WINESERVER="${TARGET}server"
fi
exec "$I386_ROOT/$PREFIX/bin/wine" "$@"

View File

@ -0,0 +1,17 @@
#!/bin/sh
TARGET="$(realpath "$0")"
if [ -z "$WINESERVER" ]; then
if [ -f "${TARGET%/*}/wineserver32" ]; then
export WINESERVER="${TARGET%/*}/wineserver32"
elif [ -f "${TARGET%/*}/wineserver" ]; then
export WINESERVER="${TARGET%/*}/wineserver"
fi
fi
# Workaround for https://bugs.winehq.org/show_bug.cgi?id=50257
export LD_BIND_NOW=1
export LD_32_BIND_NOW=1
exec "${TARGET}.bin" "$@"

15
emulators/wine8/pkg-descr Normal file
View File

@ -0,0 +1,15 @@
Wine is a Microsoft Windows compatibility layer (or program loader)
capable of running Windows applications on i386 and compatible CPUs.
Windows programs running in Wine act as native programs would, running
without the performance or memory usage penalties of an emulator, with
a similar look and feel to other applications on your desktop.
Many applications already work, more or less, including versions of
Microsoft Office and many games.
If you receive a message of "Did you reconfigure your kernel with
"options USER_LDT"?" add the line
machdep.max_ldt_segment="2048"
to /boot/loader.conf and reboot.
Gerald Pfeifer <gerald@FreeBSD.org>

2611
emulators/wine8/pkg-plist Normal file

File diff suppressed because it is too large Load Diff