Skip to content

build.yml: Cleanup CFLAGS & CROSSCFLAGS #139

build.yml: Cleanup CFLAGS & CROSSCFLAGS

build.yml: Cleanup CFLAGS & CROSSCFLAGS #139

Workflow file for this run

name: Build Wine
on:
pull_request:
push:
workflow_dispatch:
env:
CC: clang
CXX: clang++
CPATH: /usr/local/include
LIBRARY_PATH: /usr/local/lib
CFLAGS: -O3
CROSSCFLAGS: -O3 -Wno-error=incompatible-pointer-types -Wno-error=int-conversion
LDFLAGS: -Wl,-ld_classic -Wl,-headerpad_max_install_names -Wl,-rpath,@loader_path/../../ -Wl,-rpath,/usr/local/lib
MACOSX_DEPLOYMENT_TARGET: 10.14
WINE_CONFIGURE: $GITHUB_WORKSPACE/configure
BUILDROOT: $GITHUB_WORKSPACE/build
WINE_INSTALLROOT: install
WINE_MONO: https://github.com/madewokherd/wine-mono/releases/download/wine-mono-7.4.1/wine-mono-7.4.1-x86.tar.xz
jobs:
build:
runs-on: macos-13
steps:
- uses: actions/checkout@v4
- name: Use Xcode 15
run: sudo xcode-select -switch /Applications/Xcode_15.2.app/Contents/Developer
- name: Install Homebrew Packages
continue-on-error: true
run: |
REQUIRED_PACKAGES=(
# Build Dependencies
"bison"
"pkg-config"
"gcenx/wine/cx-llvm"
# Dependencies
"freetype"
"gettext"
"gnutls"
"gstreamer"
"sdl2"
"molten-vk"
"winetricks"
)
brew install "${REQUIRED_PACKAGES[@]}"
- name: Install mingw
continue-on-error: true
run: |
# As of mingw-w64 12, brew uses UCRT instead of MSVCRT
# Wine will fail to build with UCRT, so we must rollback.
curl -L https://raw.githubusercontent.com/Homebrew/homebrew-core/31209a399a7b40bf2cd3abd7aee2715547ccd5bd/Formula/m/mingw-w64.rb > mingw-w64.rb && brew install mingw-w64.rb
rm mingw-w64.rb
- name: Echo Libs [DEBUG]
run: |
echo "Brew Libs"
ls $(brew --prefix)/lib
echo "FFmpeg Libs"
ls $(brew --prefix ffmpeg@6)/lib
echo "GStreamer Libs"
ls $(brew --prefix gstreamer)/lib/gstreamer-1.0
- name: Add bison & cx-llvm to $PATH
run: |
echo "$(brew --prefix bison)/bin" >> $GITHUB_PATH
echo "$(brew --prefix cx-llvm)/bin" >> $GITHUB_PATH
- name: Configure wine64
run: |
set -x
export ac_cv_lib_soname_MoltenVK="libMoltenVK.dylib"
export ac_cv_lib_soname_vulkan=""
mkdir -p ${{ env.BUILDROOT }}/wine64
pushd ${{ env.BUILDROOT }}/wine64
${{ env.WINE_CONFIGURE }} \
--prefix= \
--disable-tests \
--disable-winedbg \
--enable-win64 \
--without-alsa \
--without-capi \
--with-coreaudio \
--with-cups \
--without-dbus \
--without-fontconfig \
--with-freetype \
--with-gettext \
--without-gettextpo \
--without-gphoto \
--with-gnutls \
--without-gssapi \
--with-gstreamer \
--without-krb5 \
--with-mingw \
--without-netapi \
--with-opencl \
--with-opengl \
--without-oss \
--with-pcap \
--with-pthread \
--without-pulse \
--without-sane \
--with-sdl \
--without-udev \
--with-unwind \
--without-usb \
--without-v4l2 \
--with-vulkan \
--without-x
popd
- name: Build wine64
run: |
pushd ${{ env.BUILDROOT }}/wine64
make -j$(sysctl -n hw.ncpu 2>/dev/null)
popd
- name: Install wine64
run: |
pushd ${{ env.BUILDROOT }}/wine64
make install-lib DESTDIR="$GITHUB_WORKSPACE/${{ env.WINE_INSTALLROOT }}"
popd
- name: Configure wine32on64
run: |
set -x
export ac_cv_lib_soname_MoltenVK="libMoltenVK.dylib"
export ac_cv_lib_soname_vulkan=""
mkdir -p ${{ env.BUILDROOT }}/wine32on64
pushd ${{ env.BUILDROOT }}/wine32on64
${{ env.WINE_CONFIGURE }} \
--prefix= \
--disable-loader \
--disable-tests \
--disable-winedbg \
--enable-win32on64 \
--without-alsa \
--without-capi \
--with-coreaudio \
--with-cups \
--without-dbus \
--without-fontconfig \
--with-freetype \
--with-gettext \
--without-gettextpo \
--without-gphoto \
--with-gnutls \
--without-gssapi \
--without-gstreamer \
--without-inotify \
--without-krb5 \
--with-mingw \
--without-netapi \
--without-openal \
--with-opencl \
--with-opengl \
--without-oss \
--with-pcap \
--with-pthread \
--without-pulse \
--without-sane \
--with-sdl \
--without-udev \
--with-unwind \
--without-usb \
--without-v4l2 \
--with-vulkan \
--with-wine64=${{ env.BUILDROOT }}/wine64 \
--without-x
popd
- name: Build wine32on64
run: |
pushd ${{ env.BUILDROOT }}/wine32on64
make -j$(sysctl -n hw.ncpu 2>/dev/null)
popd
- name: Install wine32on64
run: |
pushd ${{ env.BUILDROOT }}/wine32on64
make install-lib DESTDIR="$GITHUB_WORKSPACE/${{ env.WINE_INSTALLROOT }}"
popd
- name: Grab Verbs From Winetricks
run: |
curl -L -o verbs.txt https://raw.githubusercontent.com/Winetricks/winetricks/master/files/verbs/all.txt
- name: Create Final Package
run: |
mkdir -p Libraries/DXVK
mkdir -p Libraries/Wine
cp -a ${{ env.WINE_INSTALLROOT }}/. Libraries/Wine/
rm -rf Libraries/Wine/share/man
cp -a $(brew --prefix winetricks)/bin/winetricks Libraries
cp -a verbs.txt Libraries
cp -a DXVK Libraries
- name: Copy External Libs
run: |
LIBS=(
"libaribb24.0"
"libbluray.2"
"libfontconfig.1"
"libfreetype"
"libfreetype.6"
"libgio-2.0.0"
"libglib-2.0.0"
"libgmodule-2.0.0"
"libgmp.10"
"libgnutls.30"
"libgobject-2.0.0"
"libgraphene-1.0.0"
"libgstallocators-1.0.0"
"libgstapp-1.0.0"
"libgstaudio-1.0.0"
"libgstbase-1.0.0"
"libgstcodecparsers-1.0.0"
"libgstcodecs-1.0.0"
"libgstcontroller-1.0.0"
"libgstgl-1.0.0"
"libgstpbutils-1.0.0"
"libgstreamer-1.0.0"
"libgstriff-1.0.0"
"libgstrtp-1.0.0"
"libgstrtsp-1.0.0"
"libgstsdp-1.0.0"
"libgsttag-1.0.0"
"libgsttranscoder-1.0.0"
"libgstvideo-1.0.0"
"libgthread-2.0.0"
"libharfbuzz.0"
"libhogweed.6"
"libidn2.0"
"libintl.8"
"libjpeg.8"
"libjxl.0.10"
"libjxl_threads.0.10"
"libMoltenVK"
"libnettle.8"
"libogg.0"
"libopenvino.2420"
"libopenvino_c.2420"
"libopenvino_onnx_frontend.2420"
"libopenvino_paddle_frontend.2420"
"libopenvino_pytorch_frontend.2420"
"libopenvino_tensorflow_frontend.2420"
"libopenvino_tensorflow_lite_frontend.2420"
"liborc-0.4.0"
"libp11-kit.0"
"libpcre2-8.0"
"libpostproc.57"
"libpng16.16"
"libpugixml.1"
"librav1e.0.7"
"librist.4"
"librubberband.2"
"libsamplerate.0"
"libSDL2-2.0.0"
"libsoxr.0"
"libsrt.1.5"
"libtasn1.6"
"libtbb.12"
"libunistring.5"
"libvidstab.1.2"
"libvmaf.3"
"libvorbis.0"
"libvorbisenc.2"
"libvpx.8"
"libwebp.7"
"libwebpmux.3"
"libXau.6"
"libXdmcp.6"
"libX11.6"
"libX11-xcb.1"
"libx264.164"
"libx265.209"
"libxcb.1"
"libzimg.2"
"libzmq.5"
)
FFMPEG_LIBS=(
"libavfilter.9"
"libavformat.60"
"libavcodec.60"
"libavutil.58"
"libpostproc.57"
"libswresample.4"
"libswscale.7"
)
GSTREAMER_LIBS=(
"libgstapplemedia"
"libgstasf"
"libgstaudioconvert"
"libgstaudioparsers"
"libgstaudioresample"
"libgstavi"
"libgstcoreelements"
"libgstdebug"
"libgstdeinterlace"
"libgstid3demux"
"libgstisomp4"
"libgstlibav"
"libgstopengl"
"libgstplayback"
"libgsttypefindfunctions"
"libgstvideoconvertscale"
"libgstvideofilter"
"libgstvideoparsersbad"
"libgstwavparse"
)
for i in "${LIBS[@]}"
do
cp -Lr $(brew --prefix)/lib/"$i".dylib Libraries/Wine/lib
done
for i in "${FFMPEG_LIBS[@]}"
do
cp -Lr $(brew --prefix ffmpeg@6)/lib/"$i".dylib Libraries/Wine/lib
done
mkdir Libraries/Wine/lib/gstreamer-1.0
for i in "${GSTREAMER_LIBS[@]}"
do
cp -Lr $(brew --prefix gstreamer)/lib/gstreamer-1.0/"$i".dylib Libraries/Wine/lib/gstreamer-1.0
done
cp -a $(brew --prefix gstreamer)/lib/gstreamer-1.0/include Libraries/Wine/lib/gstreamer-1.0
# Fixup brew dylib LCs
update_dylib_paths() {
local dylib_file="$1"
local path_prefix="$2"
echo "Processing $dylib_file..."
# Extract LC_LOAD_DYLIB paths using otool
local load_dylibs=$(otool -L "$dylib_file" | grep -v "$dylib_file" | awk '{print $1}')
for path in $load_dylibs; do
if [[ $path != /usr/lib* && $path != /System/* ]]; then
# For paths not excluded, replace the prefix with @loader_path/
local lib_name="${path##*/}"
local new_path="${path_prefix}${lib_name}"
echo "Updating $path to $new_path"
# Use install_name_tool to change the path
install_name_tool -change "$path" "$new_path" "$dylib_file"
codesign -fs- "$dylib_file"
fi
done
}
export -f update_dylib_paths
find Libraries/Wine/lib -maxdepth 1 -type f -name '*.dylib' -exec bash -c 'update_dylib_paths "$0" "@loader_path/"' {} \;
find Libraries/Wine/lib/gstreamer-1.0 -maxdepth 1 -type f -name '*.dylib' -exec bash -c 'update_dylib_paths "$0" "@loader_path/../"' {} \;
update_dylib_paths Libraries/Wine/lib/wine/x86_64-unix/winegstreamer.so "@rpath/"
- name: Install GPTK
run: |
ditto GPTK/redist/lib/ Libraries/Wine/lib/
- name: Copy Version .plist
run: |
cp -a WhiskyWineVersion.plist Libraries/
- name: Install WineMono
run: |
mkdir Libraries/Wine/share/wine/mono
curl -L -o mono.tar.xz ${{ env.WINE_MONO }}
tar -xzf mono.tar.xz -C Libraries/Wine/share/wine/mono
- name: Build Checksum
run: |
find ./Libraries -type f -exec shasum "{}" + > SUMS.sha
- name: Upload config64.log
if: failure()
uses: actions/upload-artifact@v4
with:
name: config64
path: build/wine64/config.log
- name: Upload config32.log
if: failure()
uses: actions/upload-artifact@v4
with:
name: config32
path: build/wine32on64/config.log
- name: Tar Libraries
if: success()
run: |
tar -zcf Libraries.tar.gz Libraries
- name: Upload Libraries
if: success()
uses: actions/upload-artifact@v4
with:
name: Libraries
path: Libraries.tar.gz
- name: Upload SUMS
if: success()
uses: actions/upload-artifact@v4
with:
name: SUMS
path: SUMS.sha
- name: Upload Libraries to WhiskyBucket
if: ${{ github.ref == 'refs/heads/7.7' }}
env:
RCLONE_CONFIG_R2_TYPE: s3
RCLONE_CONFIG_R2_PROVIDER: Cloudflare
RCLONE_CONFIG_R2_ENV_AUTH: true
RCLONE_CONFIG_R2_ACCESS_KEY_ID: ${{ secrets.RCLONE_ACCESS_KEY_ID }}
RCLONE_CONFIG_R2_SECRET_ACCESS_KEY: ${{ secrets.RCLONE_SECRET_ACCESS_KEY }}
RCLONE_CONFIG_R2_ENDPOINT: ${{ secrets.RCLONE_ENDPOINT }}
run: |
brew install rclone
rclone copy Libraries.tar.gz r2:whisky-bucket/Wine
rclone copy WhiskyWineVersion.plist r2:whisky-bucket/Wine
rclone copy SUMS.sha r2:whisky-bucket/Wine