Skip to content

Commit f2f5220

Browse files
committed
generate 64-bit DLLs (and update gcc for it to work)
1 parent 335e066 commit f2f5220

15 files changed

Lines changed: 459 additions & 60 deletions

.github/workflows/main.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ name: Build
22

33
on: [push, pull_request]
44
jobs:
5-
build_i686:
6-
name: Build for 32 bit x86
5+
build_x86_64:
6+
name: Build for 64 bit x86_64
77
runs-on: ubuntu-22.04
88
steps:
99
- name: Install dependencies
@@ -40,7 +40,7 @@ jobs:
4040
- name: Collect Artifacts
4141
uses: actions/upload-artifact@v4
4242
with:
43-
name: usdx-dlls-i686
43+
name: usdx-dlls-x86_64
4444
path: DLLs/*
4545
if-no-files-found: error
4646
- name: Cleanup Download Cache

build.sh

Lines changed: 50 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,63 @@
11
#!/bin/sh
22
MXE=/tmp/mxe
3+
TARGET=x86_64-w64-mingw32.shared
4+
DLL_DIR=$MXE/DLLs
5+
PORTAUDIO_NAME=portaudio_x64
36
if [ "`pwd`" != $MXE ] ; then
47
echo Please clone this repository to /tmp/mxe for reproducible builds >&2
58
exit 1
69
fi
710
touch src/ffmpeg.mk src/dav1d.mk src/freetype-bootstrap.mk src/libjpeg-turbo.mk src/libpng.mk src/portaudio.mk src/sqlite.mk src/lua.mk src/sdl2.mk src/sdl2_image.mk src/zlib.mk src/libwebp.mk src/tiff.mk
811
export SOURCE_DATE_EPOCH=0
9-
make -j 2 JOBS=2 MXE_TARGETS=i686-w64-mingw32.shared ffmpeg sdl2_image freetype-bootstrap portaudio sqlite lua
10-
mkdir -p $MXE/DLLs
11-
for i in avcodec-61 avformat-61 avutil-59 swresample-5 swscale-8 libdav1d libjpeg-8 libpng16-16 libtiff-6 libwebp-7 SDL2 SDL2_image zlib1 lua54:lua5.4 libsqlite3-0:sqlite3 libfreetype-6:freetype6 libportaudio-2:portaudio_x86 ; do
12+
# Prefer system tools over a possibly broken venv shim (e.g., mako-render).
13+
export PATH=/usr/bin:$PATH
14+
# Force DWARF debug info and assume .loc support to avoid stabs on x86_64.
15+
make -j 24 JOBS=24 MXE_TARGETS=$TARGET \
16+
CFLAGS_FOR_TARGET='-O2 -gdwarf-2 -gas-loc-support' \
17+
CXXFLAGS_FOR_TARGET='-O2 -gdwarf-2 -gas-loc-support' \
18+
ffmpeg sdl2_image freetype-bootstrap portaudio sqlite lua projectm projectm-cwrapper glew
19+
20+
# Optional: unpack proprietary BASS DLL if provided.
21+
if [ -f "$MXE/pkg/bass24.zip" ]; then
22+
mkdir -p "$MXE/usr/$TARGET/bin"
23+
unzip -p "$MXE/pkg/bass24.zip" x64/bass.dll > "$MXE/usr/$TARGET/bin/bass.dll"
24+
fi
25+
mkdir -p $DLL_DIR
26+
for i in avcodec-61 avformat-61 avutil-59 swresample-5 swscale-8 libdav1d libjpeg-8 libpng16-16 libtiff-6 libwebp-7 SDL2 SDL2_image zlib1 lua54:lua libsqlite3-0:sqlite3 libfreetype-6 libharfbuzz-0 libglib-2.0-0 libpcre-1 libintl-8 libiconv-2 libdl libbz2 libportaudio-2:$PORTAUDIO_NAME libstdc++-6 libwinpthread-1 libgcc_s_seh-1 GLEW:glew32 bass projectM-cwrapper ; do
1227
j=${i##*:}
1328
i=${i%%:*}
14-
$MXE/usr/bin/i686-w64-mingw32.shared-objcopy --only-keep-debug $MXE/usr/i686-w64-mingw32.shared/bin/$i.dll $MXE/DLLs/$j.debug
29+
$MXE/usr/bin/$TARGET-objcopy --only-keep-debug $MXE/usr/$TARGET/bin/$i.dll $DLL_DIR/$j.debug 2>/dev/null || true
1530
(
16-
cd $MXE/DLLs
17-
set -- `md5sum $j.debug`
18-
k=$j-$1
19-
mv $j.debug $k.debug
20-
$MXE/usr/bin/i686-w64-mingw32.shared-objcopy -S --add-gnu-debuglink=$k.debug $MXE/usr/i686-w64-mingw32.shared/bin/$i.dll $j.dll
21-
chmod a-x $j.dll $k.debug
31+
cd $DLL_DIR
32+
if [ -f "$j.debug" ]; then
33+
set -- `md5sum $j.debug`
34+
k=$j-$1
35+
mv $j.debug $k.debug
36+
$MXE/usr/bin/$TARGET-objcopy -S --add-gnu-debuglink=$k.debug $MXE/usr/$TARGET/bin/$i.dll $j.dll
37+
chmod a-x $j.dll $k.debug
38+
else
39+
cp -f $MXE/usr/$TARGET/bin/$i.dll $j.dll
40+
chmod a-x $j.dll
41+
fi
2242
)
2343
done
44+
45+
# Add projectM DLL (keep only libprojectM-0.dll).
46+
if [ -f "$MXE/usr/$TARGET/bin/libprojectM-0.dll" ]; then
47+
dll="$MXE/usr/$TARGET/bin/libprojectM-0.dll"
48+
base=libprojectM-0
49+
$MXE/usr/bin/$TARGET-objcopy --only-keep-debug "$dll" "$DLL_DIR/$base.debug" 2>/dev/null || true
50+
(
51+
cd "$DLL_DIR"
52+
if [ -f "$base.debug" ]; then
53+
set -- `md5sum "$base.debug"`
54+
k=$base-$1
55+
mv "$base.debug" "$k.debug"
56+
$MXE/usr/bin/$TARGET-objcopy -S --add-gnu-debuglink="$k.debug" "$dll" "$base.dll"
57+
chmod a-x "$base.dll" "$k.debug"
58+
else
59+
cp -f "$dll" "$base.dll"
60+
chmod a-x "$base.dll"
61+
fi
62+
)
63+
fi

src/gcc-1-fixes.patch

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=b587c12551143c14f023860a1dbdf7
1212

1313
clang can build it correctly and this should probably be a feature test
1414

15-
diff --git a/gcc/config/i386/driver-i386.c b/gcc/config/i386/driver-i386.c
15+
diff --git a/gcc/config/i386/driver-i386.cc b/gcc/config/i386/driver-i386.cc
1616
index 1111111..2222222 100644
17-
--- a/gcc/config/i386/driver-i386.c
18-
+++ b/gcc/config/i386/driver-i386.c
17+
--- a/gcc/config/i386/driver-i386.cc
18+
+++ b/gcc/config/i386/driver-i386.cc
1919
@@ -26,7 +26,7 @@ along with GCC; see the file COPYING3. If not see
2020

2121
const char *host_detect_local_cpu (int argc, const char **argv);
@@ -36,20 +36,16 @@ diff --git a/gcc/config.gcc b/gcc/config.gcc
3636
index 1111111..2222222 100644
3737
--- a/gcc/config.gcc
3838
+++ b/gcc/config.gcc
39-
@@ -2207,7 +2207,7 @@ i[34567]86-*-mingw* | x86_64-*-mingw*)
40-
tmake_file="${tmake_file} i386/t-mingw-w32"
41-
;;
42-
esac
39+
@@
4340
- native_system_header_dir=/mingw/include
4441
+ native_system_header_dir=/include
45-
target_gtfiles="$target_gtfiles \$(srcdir)/config/i386/winnt.c"
46-
extra_options="${extra_options} i386/cygming.opt i386/mingw.opt"
47-
case ${target} in
42+
43+
4844
diff --git a/gcc/config/i386/mingw32.h b/gcc/config/i386/mingw32.h
4945
index 1111111..2222222 100644
5046
--- a/gcc/config/i386/mingw32.h
5147
+++ b/gcc/config/i386/mingw32.h
52-
@@ -198,7 +198,7 @@ along with GCC; see the file COPYING3. If not see
48+
@@ -207,7 +207,7 @@ along with GCC; see the file COPYING3. If not see
5349

5450
/* Override startfile prefix defaults. */
5551
#ifndef STANDARD_STARTFILE_PREFIX_1
@@ -58,7 +54,7 @@ index 1111111..2222222 100644
5854
#endif
5955
#ifndef STANDARD_STARTFILE_PREFIX_2
6056
#define STANDARD_STARTFILE_PREFIX_2 ""
61-
@@ -207,7 +207,7 @@ along with GCC; see the file COPYING3. If not see
57+
@@ -216,7 +216,7 @@ along with GCC; see the file COPYING3. If not see
6258
/* For native mingw-version we need to take care that NATIVE_SYSTEM_HEADER_DIR
6359
macro contains POSIX-style path. See bug 52947. */
6460
#undef NATIVE_SYSTEM_HEADER_DIR
@@ -81,22 +77,22 @@ diff --git a/libgomp/libgomp.h b/libgomp/libgomp.h
8177
index 1111111..2222222 100644
8278
--- a/libgomp/libgomp.h
8379
+++ b/libgomp/libgomp.h
84-
@@ -69,6 +69,14 @@
80+
@@ -66,6 +66,13 @@
81+
# endif
8582
# endif
8683
#endif
87-
88-
+#include <stdio.h>
84+
+
8985
+#include <stdio.h>
9086
+#ifdef __MINGW_PRINTF_FORMAT
9187
+#define PRINTF_FORMAT __MINGW_PRINTF_FORMAT
9288
+#else
9389
+#define PRINTF_FORMAT printf
9490
+#endif
95-
+
91+
9692
#ifdef HAVE_ATTRIBUTE_VISIBILITY
9793
# pragma GCC visibility push(hidden)
9894
#endif
99-
@@ -173,7 +181,7 @@ team_free (void *ptr)
95+
@@ -168,7 +175,7 @@ extern void gomp_aligned_free (void *);
10096

10197
extern void gomp_vdebug (int, const char *, va_list);
10298
extern void gomp_debug (int, const char *, ...)
@@ -105,7 +101,7 @@ index 1111111..2222222 100644
105101
#define gomp_vdebug(KIND, FMT, VALIST) \
106102
do { \
107103
if (__builtin_expect (gomp_debug_var, 0)) \
108-
@@ -186,11 +194,11 @@ extern void gomp_debug (int, const char *, ...)
104+
@@ -182,11 +189,11 @@ extern void gomp_debug (int, const char *, ...)
109105
} while (0)
110106
extern void gomp_verror (const char *, va_list);
111107
extern void gomp_error (const char *, ...)

src/gcc-2-stabs.patch

Lines changed: 0 additions & 26 deletions
This file was deleted.

src/gcc.mk

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ PKG := gcc
44
$(PKG)_WEBSITE := https://gcc.gnu.org/
55
$(PKG)_DESCR := GCC
66
$(PKG)_IGNORE :=
7-
$(PKG)_VERSION := 11.5.0
7+
$(PKG)_VERSION := 13.3.0
88
$(PKG)_RELEASE := $($(PKG)_VERSION)
9-
$(PKG)_CHECKSUM := a6e21868ead545cf87f0c01f84276e4b5281d672098591c1c896241f09363478
9+
$(PKG)_CHECKSUM := 0845e9621c9543a13f484e94584a49ffc0129970e9914624235fc1d061a0c083
1010
$(PKG)_SUBDIR := gcc-$($(PKG)_VERSION)
1111
$(PKG)_FILE := gcc-$($(PKG)_VERSION).tar.xz
1212
$(PKG)_URL := https://ftp.gnu.org/gnu/gcc/gcc-$($(PKG)_VERSION)/$($(PKG)_FILE)
@@ -79,6 +79,9 @@ define $(PKG)_BUILD_mingw-w64
7979
--with-default-win32-winnt=0x0601 \
8080
$(mingw-w64-headers_CONFIGURE_OPTS)
8181
$(MAKE) -C '$(BUILD_DIR).headers' install
82+
# GCC fixincludes expects headers in $(TARGET)/mingw/include.
83+
mkdir -p '$(PREFIX)/$(TARGET)/mingw/include'
84+
cp -a '$(PREFIX)/$(TARGET)/include/.' '$(PREFIX)/$(TARGET)/mingw/include'
8285

8386
# build standalone gcc
8487
$($(PKG)_CONFIGURE)

src/libjpeg-turbo.mk

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ define $(PKG)_BUILD
2424
-DWITH_JPEG8=ON \
2525
-DBUILD=reproducible \
2626
-DCMAKE_INSTALL_PREFIX='$(PREFIX)/$(TARGET)' \
27-
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
27+
-DCMAKE_BUILD_TYPE=Release \
28+
-DCMAKE_ASM_NASM_FLAGS='-g null' \
29+
-DCMAKE_ASM_NASM_FLAGS_RELEASE='-g null' \
2830
-DCMAKE_ASM_NASM_COMPILER=$(TARGET)-yasm
2931
$(MAKE) -C '$(BUILD_DIR)' -j '$(JOBS)'
3032
$(MAKE) -C '$(BUILD_DIR)' -j 1 install

src/projectm-1-fixes.patch

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
This file is part of MXE. See LICENSE.md for licensing information.
2+
3+
Contains ad hoc patches for cross building.
4+
5+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
6+
From: MXE <mxe@example.invalid>
7+
Date: Wed, 28 Jan 2026 00:00:00 +0000
8+
Subject: [PATCH] Fix Windows OpenGL includes and font defaults
9+
10+
11+
diff --git a/src/libprojectM/projectM-opengl.h b/src/libprojectM/projectM-opengl.h
12+
index 6c9d3d3..f0d7c5f 100644
13+
--- a/src/libprojectM/projectM-opengl.h
14+
+++ b/src/libprojectM/projectM-opengl.h
15+
@@ -8,6 +8,7 @@
16+
#ifdef __APPLE__
17+
# include <OpenGL/gl.h>
18+
#elif defined(_WIN32)
19+
# include <windows.h>
20+
+# include <GL/gl.h>
21+
#else /* linux/unix/other */
22+
# ifdef USE_GLES1
23+
# include <GLES/gl.h>
24+
25+
diff --git a/src/libprojectM/projectM.cpp b/src/libprojectM/projectM.cpp
26+
index 9a0b0c6..cb2ff4a 100644
27+
--- a/src/libprojectM/projectM.cpp
28+
+++ b/src/libprojectM/projectM.cpp
29+
@@ -208,9 +208,9 @@ void projectM::readConfig (const std::string & configFile )
30+
31+
#ifdef WIN32
32+
_settings.titleFontURL = config.read<string>
33+
- ( "Title Font", projectM_FONT_TITLE );
34+
+ ( "Title Font", "Vera.ttf" );
35+
_settings.menuFontURL = config.read<string>
36+
- ( "Menu Font", projectM_FONT_MENU );
37+
+ ( "Menu Font", "VeraMono.ttf" );
38+
#endif

src/projectm-2-fixes.patch

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
This file is part of MXE. See LICENSE.md for licensing information.
2+
3+
Contains ad hoc patches for cross building.
4+
5+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
6+
From: MXE <mxe@example.invalid>
7+
Date: Wed, 28 Jan 2026 00:00:00 +0000
8+
Subject: [PATCH] Link libprojectM against dlfcn-win32
9+
10+
11+
diff --git a/src/libprojectM/Makefile.in b/src/libprojectM/Makefile.in
12+
index 4f7cfc9..f342b3c 100644
13+
--- a/src/libprojectM/Makefile.in
14+
+++ b/src/libprojectM/Makefile.in
15+
@@ -437,4 +437,5 @@ libprojectM_la_LIBADD = \
16+
$(top_srcdir)/src/libprojectM/MilkdropPresetFactory/libMilkdropPresetFactory.la \
17+
$(top_srcdir)/src/libprojectM/NativePresetFactory/libNativePresetFactory.la \
18+
-$(top_srcdir)/src/libprojectM/Renderer/libRenderer.la
19+
+$(top_srcdir)/src/libprojectM/Renderer/libRenderer.la \
20+
+-ldl

src/projectm-3-fixes.patch

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
This file is part of MXE. See LICENSE.md for licensing information.
2+
3+
Contains ad hoc patches for cross building.
4+
5+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
6+
From: MXE <mxe@example.invalid>
7+
Date: Wed, 28 Jan 2026 00:00:00 +0000
8+
Subject: [PATCH] Skip NativePresets subdir on Windows
9+
10+
11+
diff --git a/src/Makefile.in b/src/Makefile.in
12+
index 26ceca6..b4c57b7 100644
13+
--- a/src/Makefile.in
14+
+++ b/src/Makefile.in
15+
@@ -161,2 +161,2 @@
16+
-DIST_SUBDIRS = libprojectM NativePresets projectM-sdl projectM-qt \
17+
+DIST_SUBDIRS = libprojectM projectM-sdl projectM-qt \
18+
projectM-pulseaudio
19+
@@ -331,1 +331,1 @@
20+
-SUBDIRS = libprojectM NativePresets ${PROJECTM_SDL_SUBDIR} ${PROJECTM_QT_SUBDIR}
21+
+SUBDIRS = libprojectM ${PROJECTM_SDL_SUBDIR} ${PROJECTM_QT_SUBDIR}

src/projectm-cwrapper.mk

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# This file is part of MXE. See LICENSE.md for licensing information.
2+
3+
PKG := projectm-cwrapper
4+
$(PKG)_WEBSITE := https://github.com/UltraStar-Deluxe/usdx
5+
$(PKG)_DESCR := projectM C wrapper
6+
$(PKG)_IGNORE :=
7+
$(PKG)_VERSION := 1
8+
$(PKG)_CHECKSUM :=
9+
$(PKG)_DEPS := cc projectm
10+
11+
# Local sources live in src/projectm-cwrapper
12+
13+
define $(PKG)_BUILD
14+
# Build in local tmp dir so we can pick up the import lib.
15+
'$(TARGET)-g++' -shared -Wl,--export-all-symbols -Wl,--out-implib,libprojectM-cwrapper.dll.a \
16+
-I'$(TOP_DIR)/src/projectm-cwrapper' -I'$(PREFIX)/$(TARGET)/include' -I'$(PREFIX)/$(TARGET)/include/libprojectM' \
17+
-L'$(PREFIX)/$(TARGET)/bin' -L'$(PREFIX)/$(TARGET)/lib' \
18+
-o projectM-cwrapper.dll \
19+
'$(TOP_DIR)/src/projectm-cwrapper/projectM-cwrapper.cpp' \
20+
-l:libprojectM-0.dll
21+
22+
$(INSTALL) -d '$(PREFIX)/$(TARGET)/bin'
23+
$(INSTALL) -m755 projectM-cwrapper.dll '$(PREFIX)/$(TARGET)/bin/'
24+
25+
$(INSTALL) -d '$(PREFIX)/$(TARGET)/lib'
26+
$(INSTALL) -m644 libprojectM-cwrapper.dll.a '$(PREFIX)/$(TARGET)/lib/'
27+
endef

0 commit comments

Comments
 (0)