diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0aff2d3e1e..012d3a744c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -2,8 +2,8 @@ name: Build on: [push, pull_request] jobs: - build_i686: - name: Build for 32 bit x86 + build_x86_64: + name: Build for 64 bit x86_64 runs-on: ubuntu-22.04 steps: - name: Install dependencies @@ -40,7 +40,7 @@ jobs: - name: Collect Artifacts uses: actions/upload-artifact@v4 with: - name: usdx-dlls-i686 + name: usdx-dlls-x86_64 path: DLLs/* if-no-files-found: error - name: Cleanup Download Cache diff --git a/.gitignore b/.gitignore index 2ae7c6899c..98d46c34d9 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ /wip/ /tmp-* /.ccache +/DLLs/ # generated by cmake projects CMakeCache.txt diff --git a/build.sh b/build.sh index 3d114fe3d2..007754e4d4 100755 --- a/build.sh +++ b/build.sh @@ -1,23 +1,72 @@ #!/bin/sh MXE=/tmp/mxe +TARGET=x86_64-w64-mingw32.shared +DLL_DIR=$MXE/DLLs +PORTAUDIO_NAME=portaudio_x64 if [ "`pwd`" != $MXE ] ; then echo Please clone this repository to /tmp/mxe for reproducible builds >&2 exit 1 fi 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 export SOURCE_DATE_EPOCH=0 -make -j 2 JOBS=2 MXE_TARGETS=i686-w64-mingw32.shared ffmpeg sdl2_image freetype-bootstrap portaudio sqlite lua -mkdir -p $MXE/DLLs -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 - j=${i##*:} - i=${i%%:*} - $MXE/usr/bin/i686-w64-mingw32.shared-objcopy --only-keep-debug $MXE/usr/i686-w64-mingw32.shared/bin/$i.dll $MXE/DLLs/$j.debug +# Replace local wrapper sources with USDX versions before building. +USDX_RAW_BASE="https://raw.githubusercontent.com/UltraStar-Deluxe/USDX/2b0ffa2e5e90b30e35f9f8f178a07a32033f451f" +fetch_wrapper() { + url="$1" + out="$2" + if command -v curl >/dev/null 2>&1; then + curl -fsSL "$url" -o "$out" + return $? + fi + if command -v wget >/dev/null 2>&1; then + wget -qO "$out" "$url" + return $? + fi + echo "Missing curl/wget to fetch USDX wrappers" >&2 + return 1 +} +mkdir -p src/opencvwrapper src/projectm-cwrapper +fetch_wrapper "$USDX_RAW_BASE/src/lib/openCV3/ApiWrapper.cpp" \ + "src/opencvwrapper/opencv-wrapper.cpp" +fetch_wrapper "$USDX_RAW_BASE/src/lib/projectM/cwrapper/projectM-cwrapper.cpp" \ + "src/projectm-cwrapper/projectM-cwrapper.cpp" +fetch_wrapper "$USDX_RAW_BASE/src/lib/projectM/cwrapper/projectM-cwrapper.h" \ + "src/projectm-cwrapper/projectM-cwrapper.h" +# Force DWARF debug info and assume .loc support to avoid stabs on x86_64. +make MXE_TARGETS=$TARGET \ + CFLAGS_FOR_TARGET='-O2 -gdwarf-2 -gas-loc-support' \ + CXXFLAGS_FOR_TARGET='-O2 -gdwarf-2 -gas-loc-support' \ + ffmpeg sdl2_image freetype-bootstrap portaudio sqlite lua opencv opencvwrapper projectm projectm-cwrapper +mkdir -p $DLL_DIR +OBJ_COPY="$MXE/usr/bin/$TARGET-objcopy" +add_dll() { + dll="$1" + base="$2" + alias_opencv="$3" + [ -x "$OBJ_COPY" ] || return 0 + [ -e "$dll" ] || return 0 + $OBJ_COPY --only-keep-debug "$dll" "$DLL_DIR/$base.debug" ( - cd $MXE/DLLs - set -- `md5sum $j.debug` - k=$j-$1 - mv $j.debug $k.debug - $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 - chmod a-x $j.dll $k.debug + cd "$DLL_DIR" + set -- `md5sum "$base.debug"` + k=$base-$1 + mv "$base.debug" "$k.debug" + $OBJ_COPY -S --add-gnu-debuglink="$k.debug" "$dll" "$base.dll" + chmod a-x "$base.dll" "$k.debug" + if [ "$alias_opencv" = "alias_opencv" ] && [ "${base#opencv_}" != "$base" ]; then + cp "$base.dll" "lib$base.dll" + fi ) +} +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 libportaudio-2:$PORTAUDIO_NAME libbz2 libdl libgcc_s_seh-1 libstdc++-6 libwinpthread-1; do + j=${i##*:} + i=${i%%:*} + DLL_PATH="$MXE/usr/$TARGET/bin/$i.dll" + add_dll "$DLL_PATH" "$j" +done + +# Add OpenCV and wrapper DLL(s) if present. +for dll in "$MXE/usr/$TARGET/bin"/opencv_*.dll "$MXE/usr/$TARGET/bin"/libopencv_*.dll "$MXE/usr/$TARGET/bin"/opencvwrapper.dll "$MXE/usr/$TARGET/bin"/libprojectM*.dll "$MXE/usr/$TARGET/bin"/projectM-cwrapper.dll; do + base=$(basename "$dll" .dll) + add_dll "$dll" "$base" done diff --git a/src/gcc-1-fixes.patch b/src/gcc-1-fixes.patch index 803179bf55..cf4bcbbcc3 100644 --- a/src/gcc-1-fixes.patch +++ b/src/gcc-1-fixes.patch @@ -12,10 +12,10 @@ https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=b587c12551143c14f023860a1dbdf7 clang can build it correctly and this should probably be a feature test -diff --git a/gcc/config/i386/driver-i386.c b/gcc/config/i386/driver-i386.c +diff --git a/gcc/config/i386/driver-i386.cc b/gcc/config/i386/driver-i386.cc index 1111111..2222222 100644 ---- a/gcc/config/i386/driver-i386.c -+++ b/gcc/config/i386/driver-i386.c +--- a/gcc/config/i386/driver-i386.cc ++++ b/gcc/config/i386/driver-i386.cc @@ -26,7 +26,7 @@ along with GCC; see the file COPYING3. If not see 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 index 1111111..2222222 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc -@@ -2207,7 +2207,7 @@ i[34567]86-*-mingw* | x86_64-*-mingw*) - tmake_file="${tmake_file} i386/t-mingw-w32" - ;; - esac +@@ - native_system_header_dir=/mingw/include + native_system_header_dir=/include - target_gtfiles="$target_gtfiles \$(srcdir)/config/i386/winnt.c" - extra_options="${extra_options} i386/cygming.opt i386/mingw.opt" - case ${target} in + + diff --git a/gcc/config/i386/mingw32.h b/gcc/config/i386/mingw32.h index 1111111..2222222 100644 --- a/gcc/config/i386/mingw32.h +++ b/gcc/config/i386/mingw32.h -@@ -198,7 +198,7 @@ along with GCC; see the file COPYING3. If not see +@@ -207,7 +207,7 @@ along with GCC; see the file COPYING3. If not see /* Override startfile prefix defaults. */ #ifndef STANDARD_STARTFILE_PREFIX_1 @@ -58,7 +54,7 @@ index 1111111..2222222 100644 #endif #ifndef STANDARD_STARTFILE_PREFIX_2 #define STANDARD_STARTFILE_PREFIX_2 "" -@@ -207,7 +207,7 @@ along with GCC; see the file COPYING3. If not see +@@ -216,7 +216,7 @@ along with GCC; see the file COPYING3. If not see /* For native mingw-version we need to take care that NATIVE_SYSTEM_HEADER_DIR macro contains POSIX-style path. See bug 52947. */ #undef NATIVE_SYSTEM_HEADER_DIR @@ -81,22 +77,22 @@ diff --git a/libgomp/libgomp.h b/libgomp/libgomp.h index 1111111..2222222 100644 --- a/libgomp/libgomp.h +++ b/libgomp/libgomp.h -@@ -69,6 +69,14 @@ +@@ -66,6 +66,13 @@ + # endif # endif #endif - -+#include ++ +#include +#ifdef __MINGW_PRINTF_FORMAT +#define PRINTF_FORMAT __MINGW_PRINTF_FORMAT +#else +#define PRINTF_FORMAT printf +#endif -+ + #ifdef HAVE_ATTRIBUTE_VISIBILITY # pragma GCC visibility push(hidden) #endif -@@ -173,7 +181,7 @@ team_free (void *ptr) +@@ -168,7 +175,7 @@ extern void gomp_aligned_free (void *); extern void gomp_vdebug (int, const char *, va_list); extern void gomp_debug (int, const char *, ...) @@ -105,7 +101,7 @@ index 1111111..2222222 100644 #define gomp_vdebug(KIND, FMT, VALIST) \ do { \ if (__builtin_expect (gomp_debug_var, 0)) \ -@@ -186,11 +194,11 @@ extern void gomp_debug (int, const char *, ...) +@@ -182,11 +189,11 @@ extern void gomp_debug (int, const char *, ...) } while (0) extern void gomp_verror (const char *, va_list); extern void gomp_error (const char *, ...) diff --git a/src/gcc-2-stabs.patch b/src/gcc-2-stabs.patch deleted file mode 100644 index a12caf92cb..0000000000 --- a/src/gcc-2-stabs.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 9310d8332533fed2ccc898b54dad7448d0f05c34 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Daniel=20Gl=C3=B6ckner?= -Date: Mon, 29 May 2023 15:04:54 +0200 -Subject: [PATCH] Prefer stabs debugging info on 32 bit Windows - -That's what the Free Pascal backtrace code expects by default. ---- - gcc/config/i386/cygming.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/gcc/config/i386/cygming.h b/gcc/config/i386/cygming.h -index cfbca34f9..6e655fbbb 100644 ---- a/gcc/config/i386/cygming.h -+++ b/gcc/config/i386/cygming.h -@@ -25,7 +25,7 @@ along with GCC; see the file COPYING3. If not see - - #undef PREFERRED_DEBUGGING_TYPE - #if (DWARF2_DEBUGGING_INFO) --#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG -+#define PREFERRED_DEBUGGING_TYPE (TARGET_64BIT ? DWARF2_DEBUG : DBX_DEBUG) - #else - #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG - #endif --- -2.20.1 - diff --git a/src/gcc.mk b/src/gcc.mk index d2ee46a821..bbc7f5cf51 100644 --- a/src/gcc.mk +++ b/src/gcc.mk @@ -4,9 +4,9 @@ PKG := gcc $(PKG)_WEBSITE := https://gcc.gnu.org/ $(PKG)_DESCR := GCC $(PKG)_IGNORE := -$(PKG)_VERSION := 11.5.0 +$(PKG)_VERSION := 13.4.0 $(PKG)_RELEASE := $($(PKG)_VERSION) -$(PKG)_CHECKSUM := a6e21868ead545cf87f0c01f84276e4b5281d672098591c1c896241f09363478 +$(PKG)_CHECKSUM := 9c4ce6dbb040568fdc545588ac03c5cbc95a8dbf0c7aa490170843afb59ca8f5 $(PKG)_SUBDIR := gcc-$($(PKG)_VERSION) $(PKG)_FILE := gcc-$($(PKG)_VERSION).tar.xz $(PKG)_URL := https://ftp.gnu.org/gnu/gcc/gcc-$($(PKG)_VERSION)/$($(PKG)_FILE) @@ -79,6 +79,9 @@ define $(PKG)_BUILD_mingw-w64 --with-default-win32-winnt=0x0601 \ $(mingw-w64-headers_CONFIGURE_OPTS) $(MAKE) -C '$(BUILD_DIR).headers' install + # GCC fixincludes expects headers in $(TARGET)/mingw/include. + mkdir -p '$(PREFIX)/$(TARGET)/mingw/include' + cp -a '$(PREFIX)/$(TARGET)/include/.' '$(PREFIX)/$(TARGET)/mingw/include' # build standalone gcc $($(PKG)_CONFIGURE) diff --git a/src/libjpeg-turbo.mk b/src/libjpeg-turbo.mk index d7be96d47f..9a29859850 100644 --- a/src/libjpeg-turbo.mk +++ b/src/libjpeg-turbo.mk @@ -23,8 +23,15 @@ define $(PKG)_BUILD -DENABLE_STATIC=$(CMAKE_STATIC_BOOL) \ -DWITH_JPEG8=ON \ -DBUILD=reproducible \ - -DCMAKE_INSTALL_PREFIX='$(PREFIX)/$(TARGET)' \ - -DCMAKE_BUILD_TYPE=RelWithDebInfo \ + -DCMAKE_INSTALL_PREFIX='$(PREFIX)/$(TARGET)' \ + -DCMAKE_BUILD_TYPE=RelWithDebInfo \ + -DCMAKE_C_FLAGS='-gdwarf-2' \ + -DCMAKE_CXX_FLAGS='-gdwarf-2' \ + -DCMAKE_ASM_NASM_FLAGS='-g null' \ + -DCMAKE_ASM_NASM_FLAGS_DEBUG='-g null' \ + -DCMAKE_ASM_NASM_FLAGS_RELEASE='-g null' \ + -DCMAKE_ASM_NASM_FLAGS_RELWITHDEBINFO='-g null' \ + -DCMAKE_ASM_NASM_FLAGS_MINSIZEREL='-g null' \ -DCMAKE_ASM_NASM_COMPILER=$(TARGET)-yasm $(MAKE) -C '$(BUILD_DIR)' -j '$(JOBS)' $(MAKE) -C '$(BUILD_DIR)' -j 1 install diff --git a/src/opencv.mk b/src/opencv.mk index 4b772ec43a..f301937324 100644 --- a/src/opencv.mk +++ b/src/opencv.mk @@ -7,8 +7,7 @@ $(PKG)_IGNORE := $(PKG)_VERSION := 4.6.0 $(PKG)_CHECKSUM := 1ec1cba65f9f20fe5a41fda1586e01c70ea0c9a6d7b67c9e13edf0cfe2239277 $(PKG)_GH_CONF := opencv/opencv/releases -$(PKG)_DEPS := cc eigen ffmpeg jasper jpeg libpng libwebp \ - openblas openexr protobuf tiff xz zlib +$(PKG)_DEPS := cc libjpeg-turbo # -DCMAKE_CXX_STANDARD=98 required for non-posix gcc7 build @@ -17,28 +16,65 @@ define $(PKG)_BUILD cd '$(BUILD_DIR)' && '$(TARGET)-cmake' '$(SOURCE_DIR)' \ -DWITH_QT=OFF \ -DWITH_OPENGL=ON \ + -DWITH_FFMPEG=OFF \ -DWITH_GSTREAMER=OFF \ -DWITH_GTK=OFF \ -DWITH_VIDEOINPUT=ON \ -DWITH_XINE=OFF \ -DWITH_LAPACK=OFF \ + -DWITH_EIGEN=OFF \ + -DWITH_OPENBLAS=OFF \ + -DWITH_IPP=OFF \ -DBUILD_opencv_apps=OFF \ + -DBUILD_opencv_calib3d=OFF \ + -DBUILD_opencv_dnn=OFF \ -DBUILD_DOCS=OFF \ -DBUILD_EXAMPLES=OFF \ + -DBUILD_opencv_features2d=OFF \ + -DBUILD_opencv_flann=OFF \ + -DBUILD_opencv_gapi=OFF \ + -DBUILD_opencv_highgui=OFF \ + -DBUILD_opencv_java_bindings_generator=OFF \ + -DBUILD_opencv_ml=OFF \ + -DBUILD_opencv_objdetect=OFF \ + -DBUILD_opencv_photo=OFF \ + -DBUILD_opencv_python2=OFF \ + -DBUILD_opencv_python_bindings_generator=OFF \ + -DBUILD_opencv_python_tests=OFF \ -DBUILD_PACKAGE=OFF \ -DBUILD_PERF_TESTS=OFF \ + -DBUILD_opencv_stitching=OFF \ -DBUILD_TESTS=OFF \ + -DBUILD_opencv_ts=OFF \ + -DBUILD_opencv_video=OFF \ -DBUILD_WITH_DEBUG_INFO=OFF \ -DBUILD_FAT_JAVA_LIB=OFF \ + -DCV_TRACE=OFF \ -DBUILD_ZLIB=OFF \ -DBUILD_TIFF=OFF \ -DBUILD_JASPER=OFF \ -DBUILD_JPEG=OFF \ -DBUILD_WEBP=OFF \ -DBUILD_PROTOBUF=OFF \ - -DPROTOBUF_UPDATE_FILES=ON \ -DBUILD_PNG=OFF \ -DBUILD_OPENEXR=OFF \ + -DWITH_JPEG=ON \ + -DWITH_PNG=OFF \ + -DWITH_TIFF=OFF \ + -DWITH_WEBP=OFF \ + -DWITH_JASPER=OFF \ + -DWITH_OPENJPEG=OFF \ + -DWITH_OPENEXR=OFF \ + -DWITH_PROTOBUF=OFF \ + -DWITH_ZLIB=OFF \ + -DWITH_ADE=OFF \ + -DWITH_QUIRC=OFF \ + -DWITH_GDAL=OFF \ + -DWITH_GDCM=OFF \ + -DWITH_IMGCODEC_HDR=OFF \ + -DWITH_IMGCODEC_SUNRASTER=OFF \ + -DWITH_IMGCODEC_PXM=OFF \ + -DWITH_IMGCODEC_PFM=OFF \ -DCMAKE_VERBOSE=ON \ -DOPENCV_GENERATE_PKGCONFIG=ON @@ -48,8 +84,4 @@ define $(PKG)_BUILD $(INSTALL) -m755 '$(BUILD_DIR)/unix-install/opencv4.pc' '$(PREFIX)/$(TARGET)/lib/pkgconfig' - '$(TARGET)-g++' \ - -W -Wall -Werror -ansi -std=c++11 \ - '$(SOURCE_DIR)/samples/cpp/fback.cpp' -o '$(PREFIX)/$(TARGET)/bin/test-opencv.exe' \ - `'$(TARGET)-pkg-config' opencv4 libavcodec libavformat libswscale --cflags --libs` -lwebp endef diff --git a/src/opencvwrapper.mk b/src/opencvwrapper.mk new file mode 100644 index 0000000000..d1cc30b5af --- /dev/null +++ b/src/opencvwrapper.mk @@ -0,0 +1,19 @@ +# This file is part of MXE. See LICENSE.md for licensing information. + + +PKG := opencvwrapper +$(PKG)_WEBSITE := https://opencv.org/ +$(PKG)_DESCR := OpenCV C-wrapper for USDX +$(PKG)_IGNORE := +$(PKG)_VERSION := 1 +$(PKG)_SUBDIR := opencvwrapper-src +$(PKG)_SOURCE_TREE := $(TOP_DIR) +$(PKG)_DEPS := cc opencv + +# Build the USDX OpenCV wrapper as a DLL linked to OpenCV 4.x. +define $(PKG)_BUILD + '$(TARGET)-g++' -shared -o '$(PREFIX)/$(TARGET)/bin/opencvwrapper.dll' \ + '$(TOP_DIR)/src/opencvwrapper/opencv-wrapper.cpp' \ + -O2 -DNDEBUG \ + `$(TARGET)-pkg-config opencv4 --cflags --libs` +endef diff --git a/src/projectm-1-fixes.patch b/src/projectm-1-fixes.patch new file mode 100644 index 0000000000..f93ab02742 --- /dev/null +++ b/src/projectm-1-fixes.patch @@ -0,0 +1,38 @@ +This file is part of MXE. See LICENSE.md for licensing information. + +Contains ad hoc patches for cross building. + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: MXE +Date: Wed, 28 Jan 2026 00:00:00 +0000 +Subject: [PATCH] Fix Windows OpenGL includes and font defaults + + +diff --git a/src/libprojectM/projectM-opengl.h b/src/libprojectM/projectM-opengl.h +index 6c9d3d3..f0d7c5f 100644 +--- a/src/libprojectM/projectM-opengl.h ++++ b/src/libprojectM/projectM-opengl.h +@@ -8,6 +8,7 @@ + #ifdef __APPLE__ + # include + #elif defined(_WIN32) + # include ++# include + #else /* linux/unix/other */ + # ifdef USE_GLES1 + # include + +diff --git a/src/libprojectM/projectM.cpp b/src/libprojectM/projectM.cpp +index 9a0b0c6..cb2ff4a 100644 +--- a/src/libprojectM/projectM.cpp ++++ b/src/libprojectM/projectM.cpp +@@ -208,9 +208,9 @@ void projectM::readConfig (const std::string & configFile ) + + #ifdef WIN32 + _settings.titleFontURL = config.read +- ( "Title Font", projectM_FONT_TITLE ); ++ ( "Title Font", "Vera.ttf" ); + _settings.menuFontURL = config.read +- ( "Menu Font", projectM_FONT_MENU ); ++ ( "Menu Font", "VeraMono.ttf" ); + #endif diff --git a/src/projectm-2-fixes.patch b/src/projectm-2-fixes.patch new file mode 100644 index 0000000000..4854b4dafb --- /dev/null +++ b/src/projectm-2-fixes.patch @@ -0,0 +1,86 @@ +This file is part of MXE. See LICENSE.md for licensing information. + +Contains ad hoc patches for cross building. + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: MXE +Date: Mon, 23 Feb 2026 00:00:00 +0000 +Subject: [PATCH] Use MinGW dirent.h instead of bundled win32-dirent shim + +diff --git a/src/libprojectM/PresetLoader.hpp b/src/libprojectM/PresetLoader.hpp +--- a/src/libprojectM/PresetLoader.hpp ++++ b/src/libprojectM/PresetLoader.hpp +@@ -5,11 +5,11 @@ + #include // for auto pointers + #include + +-#ifdef WIN32 ++#if defined(WIN32) && !defined(__MINGW32__) + #include "win32-dirent.h" + #endif + +-#ifdef __unix__ ++#if defined(__unix__) || defined(__MINGW32__) + #include + #endif + + diff --git a/src/libprojectM/projectM.hpp b/src/libprojectM/projectM.hpp +--- a/src/libprojectM/projectM.hpp ++++ b/src/libprojectM/projectM.hpp +@@ -29,7 +29,7 @@ + #ifndef _PROJECTM_HPP + #define _PROJECTM_HPP + +-#ifdef WIN32 ++#if defined(WIN32) && !defined(__MINGW32__) + #include "win32-dirent.h" + #else + #include + #endif /** WIN32 */ + +diff --git a/src/libprojectM/projectM.cpp b/src/libprojectM/projectM.cpp +--- a/src/libprojectM/projectM.cpp ++++ b/src/libprojectM/projectM.cpp +@@ -24,7 +24,7 @@ + #include "fatal.h" + #include "Common.hpp" + +-#ifdef WIN32 ++#if defined(WIN32) && !defined(__MINGW32__) + #include "win32-dirent.h" + #endif + + #include "timer.h" + +diff --git a/src/libprojectM/Renderer/TextureManager.cpp b/src/libprojectM/Renderer/TextureManager.cpp +--- a/src/libprojectM/Renderer/TextureManager.cpp ++++ b/src/libprojectM/Renderer/TextureManager.cpp +@@ -6,11 +6,11 @@ + #include "SOIL2/SOIL2.h" + #endif + +-#ifdef WIN32 ++#if defined(WIN32) && !defined(__MINGW32__) + #include "win32-dirent.h" + #endif + +-#ifdef __unix__ ++#if defined(__unix__) || defined(__MINGW32__) + #include + #endif + #ifdef EMSCRIPTEN + #include + +diff --git a/src/libprojectM/MilkdropPresetFactory/MilkdropPreset.cpp b/src/libprojectM/MilkdropPresetFactory/MilkdropPreset.cpp +--- a/src/libprojectM/MilkdropPresetFactory/MilkdropPreset.cpp ++++ b/src/libprojectM/MilkdropPresetFactory/MilkdropPreset.cpp +@@ -23,7 +23,7 @@ + #include + #include + +-#ifdef WIN32 ++#if defined(WIN32) && !defined(__MINGW32__) + #include "win32-dirent.h" + #else + #include + #endif /** WIN32 */ diff --git a/src/projectm-3-fixes.patch b/src/projectm-3-fixes.patch new file mode 100644 index 0000000000..6ef63086da --- /dev/null +++ b/src/projectm-3-fixes.patch @@ -0,0 +1,176 @@ +This file is part of MXE. See LICENSE.md for licensing information. + +Contains ad hoc patches for cross building. + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: MXE +Date: Sat, 28 Mar 2026 00:00:00 +0000 +Subject: [PATCH] Backport build system fixes + +Backport the downstream USDX packaging fixes so projectM installs the +public headers needed by consumers, avoids requiring generated config.h +from Common.hpp, fixes DESTDIR handling for preset installation, +restores pkg-config metadata generation, and links libprojectM against +the detected dlfcn library. + +diff --git a/Makefile.am b/Makefile.am +--- a/Makefile.am ++++ b/Makefile.am +@@ -18,8 +18,8 @@ pm_shaders__DATA = src/libprojectM/Renderer/blur.cg \ + + # find and install all preset files + install-data-local: +- test -z $(pkgdatadir) || $(MKDIR_P) $(pm_presets_dir) +- find "$(PRESETSDIR)" -type f -exec $(INSTALL_DATA) {} $(pm_presets_dir) \; ++ test -z $(DESTDIR)$(pkgdatadir) || $(MKDIR_P) $(DESTDIR)$(pm_presets_dir) ++ find "$(PRESETSDIR)" -type f -exec $(INSTALL_DATA) {} $(DESTDIR)$(pm_presets_dir) \; + + # from https://stackoverflow.com/questions/30897170/ac-subst-does-not-expand-variable answer: https://stackoverflow.com/a/30960268 + # ptomato https://stackoverflow.com/users/172999/ptomato +diff --git a/autogen.sh b/autogen.sh +new file mode 100755 +--- /dev/null ++++ b/autogen.sh +@@ -0,0 +1,5 @@ ++#!/bin/sh ++ ++autoreconf --install || exit 1 ++ ++echo "Now run ./configure && make" +diff --git a/configure.ac b/configure.ac +--- a/configure.ac ++++ b/configure.ac +@@ -11,3 +11,4 @@ AX_CHECK_GL + AC_CHECK_LIB(c, dlopen, LIBDL="", AC_CHECK_LIB(dl, dlopen, LIBDL="-ldl")) ++AC_SUBST([LIBDL]) + + AC_CONFIG_HEADERS([config.h]) +@@ -19,8 +20,9 @@ AC_CONFIG_FILES([ + src/libprojectM/Renderer/Makefile + src/libprojectM/NativePresetFactory/Makefile + src/libprojectM/MilkdropPresetFactory/Makefile ++ src/libprojectM/libprojectM.pc + src/NativePresets/Makefile + src/projectM-sdl/Makefile + src/projectM-qt/Makefile + src/projectM-pulseaudio/Makefile + ]) + +@@ -91,6 +93,7 @@ case $host_os in + darwin*) + # OSX needs CoreFoundation + AC_MSG_RESULT(Apple hoarderware detected) ++ NATIVE_PRESETS_SUBDIR=NativePresets + LIBS="$LIBS -framework CoreFoundation" + ;; + linux*) +@@ -98,10 +101,17 @@ case $host_os in + # limux needs dl + AC_MSG_RESULT(GNU/LINUX detected) + LIBS="$LIBS -ldl" ++ NATIVE_PRESETS_SUBDIR=NativePresets ++ ;; ++ mingw* | msys*) ++ AC_MSG_RESULT(MinGW detected) ++ NATIVE_PRESETS_SUBDIR= ++ ;; ++ *) ++ NATIVE_PRESETS_SUBDIR=NativePresets + ;; + esac +- +- ++AC_SUBST([NATIVE_PRESETS_SUBDIR]) + + +diff --git a/src/Makefile.am b/src/Makefile.am +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -9 +9 @@ endif +-SUBDIRS=libprojectM NativePresets ${PROJECTM_SDL_SUBDIR} ${PROJECTM_QT_SUBDIR} ++SUBDIRS=libprojectM ${NATIVE_PRESETS_SUBDIR} ${PROJECTM_SDL_SUBDIR} ${PROJECTM_QT_SUBDIR} +@@ -9,0 +10,4 @@ SUBDIRS=libprojectM ${NATIVE_PRESETS_SUBDIR} ${PROJECTM_SDL_SUBDIR} ${PROJECTM_QT_SUBDIR} ++ ++# system headers/libraries/data to install ++# for compatibility reasons here as nobase_include ++nobase_include_HEADERS = libprojectM/projectM.hpp libprojectM/Common.hpp libprojectM/dlldefs.h libprojectM/event.h libprojectM/fatal.h libprojectM/PCM.hpp +diff --git a/src/NativePresets/Makefile.am b/src/NativePresets/Makefile.am +--- a/src/NativePresets/Makefile.am ++++ b/src/NativePresets/Makefile.am +@@ -17,6 +17,15 @@ presets_LTLIBRARIES = \ + libRovastarFractalSpiral.la \ + libRovastarFractopiaFrantic.la + ++AM_LDFLAGS = -module -avoid-version -no-undefined ++ ++libMstressJuppyDancer_la_LIBADD = $(top_builddir)/src/libprojectM/libprojectM.la ++libRLGFractalDrop7c_la_LIBADD = $(top_builddir)/src/libprojectM/libprojectM.la ++libRovastarDarkSecret_la_LIBADD = $(top_builddir)/src/libprojectM/libprojectM.la ++libRovastarDriftingChaos_la_LIBADD = $(top_builddir)/src/libprojectM/libprojectM.la ++libRovastarFractalSpiral_la_LIBADD = $(top_builddir)/src/libprojectM/libprojectM.la ++libRovastarFractopiaFrantic_la_LIBADD = $(top_builddir)/src/libprojectM/libprojectM.la ++ + libMstressJuppyDancer_la_SOURCES = MstressJuppyDancer.cpp + libRLGFractalDrop7c_la_SOURCES = RLGFractalDrop7c.cpp + libRovastarDarkSecret_la_SOURCES = RovastarDarkSecret.cpp +diff --git a/src/libprojectM/Common.hpp b/src/libprojectM/Common.hpp +--- a/src/libprojectM/Common.hpp ++++ b/src/libprojectM/Common.hpp +@@ -30,7 +30,6 @@ + #include + #include + #include +-#include "config.h" + #ifdef _MSC_sVER + #define strcasecmp(s, t) _strcmpi(s, t) + #endif +diff --git a/src/libprojectM/Makefile.am b/src/libprojectM/Makefile.am +--- a/src/libprojectM/Makefile.am ++++ b/src/libprojectM/Makefile.am +@@ -10,8 +10,6 @@ AM_CPPFLAGS = \ + -I$(top_srcdir)/src/libprojectM/Renderer \ + ${FTGL_CFLAGS} + +-# system headers/libraries/data to install +-include_HEADERS = projectM.hpp + lib_LTLIBRARIES = libprojectM.la # public, possibly-shared library + + # link flags +@@ -16,7 +14,8 @@ libprojectM_la_LDFLAGS = -no-undefined -version-info 0:2:0 + # link libRenderer, MilkdropPresetFactory, NativePresetFactory, and libprojectM sources + libprojectM_la_LIBADD = \ + $(top_srcdir)/src/libprojectM/MilkdropPresetFactory/libMilkdropPresetFactory.la \ +-$(top_srcdir)/src/libprojectM/NativePresetFactory/libNativePresetFactory.la \ ++$(top_srcdir)/src/libprojectM/NativePresetFactory/libNativePresetFactory.la \ ++$(LIBDL) \ + $(top_srcdir)/src/libprojectM/Renderer/libRenderer.la + libprojectM_la_SOURCES = ConfigFile.cpp Preset.cpp PresetLoader.cpp timer.cpp \ + KeyHandler.cpp PresetChooser.cpp TimeKeeper.cpp PCM.cpp PresetFactory.cpp \ +@@ -47,6 +46,6 @@ libprojectM_la_SOURCES = ConfigFile.cpp Preset.cpp PresetLoader.cpp timer.cpp \ + omptl/omptl_algorithm + + pkgconfigdir = $(libdir)/pkgconfig +-# pkgconfig_DATA = src/libprojectM.pc +-# EXTRA_DIST += src/libprojectM.pc.in +-# CLEANFILES += src/libprojectM.pc ++pkgconfig_DATA = libprojectM.pc ++EXTRA_DIST += libprojectM.pc.in ++CLEANFILES += libprojectM.pc +diff --git a/src/libprojectM/libprojectM.pc.in b/src/libprojectM/libprojectM.pc.in +new file mode 100644 +--- /dev/null ++++ b/src/libprojectM/libprojectM.pc.in +@@ -0,0 +1,13 @@ ++prefix=@prefix@ ++exec_prefix=@exec_prefix@ ++libdir=@libdir@ ++includedir=@includedir@ ++pkgdatadir=@datadir@/@PACKAGE_NAME@ ++sysconfdir=@datadir@/@PACKAGE_NAME@ ++ ++Name: libprojectM ++Version: @PACKAGE_VERSION@ ++Description: projectM - OpenGL Milkdrop ++Requires: ++Libs: -L${libdir} -lprojectM ++Cflags: -I${includedir} diff --git a/src/projectm-cwrapper.mk b/src/projectm-cwrapper.mk new file mode 100644 index 0000000000..e8a189f070 --- /dev/null +++ b/src/projectm-cwrapper.mk @@ -0,0 +1,23 @@ +# This file is part of MXE. See LICENSE.md for licensing information. + +PKG := projectm-cwrapper +$(PKG)_WEBSITE := https://github.com/UltraStar-Deluxe/usdx +$(PKG)_DESCR := projectM C wrapper +$(PKG)_IGNORE := +$(PKG)_VERSION := 1 +$(PKG)_CHECKSUM := +$(PKG)_DEPS := cc projectm + +# Local sources live in src/projectm-cwrapper + +define $(PKG)_BUILD + '$(TARGET)-g++' -shared \ + -I'$(TOP_DIR)/src/projectm-cwrapper' -I'$(PREFIX)/$(TARGET)/include' -I'$(PREFIX)/$(TARGET)/include/libprojectM' \ + -L'$(PREFIX)/$(TARGET)/bin' -L'$(PREFIX)/$(TARGET)/lib' \ + -o projectM-cwrapper.dll \ + '$(TOP_DIR)/src/projectm-cwrapper/projectM-cwrapper.cpp' \ + -l:libprojectM-0.dll -lopengl32 + + $(INSTALL) -d '$(PREFIX)/$(TARGET)/bin' + $(INSTALL) -m755 projectM-cwrapper.dll '$(PREFIX)/$(TARGET)/bin/' +endef diff --git a/src/projectm-cwrapper/Makefile b/src/projectm-cwrapper/Makefile new file mode 100755 index 0000000000..709a8b90f8 --- /dev/null +++ b/src/projectm-cwrapper/Makefile @@ -0,0 +1,28 @@ +PROJECTM_PREFIX ?= ../../../../../mxe/usr/x86_64-w64-mingw32.shared + +CXX ?= g++ +CXXFLAGS ?= -O2 -g +CPPFLAGS ?= +LDFLAGS ?= + +INCLUDES = -I. -I$(PROJECTM_PREFIX)/include -I$(PROJECTM_PREFIX)/include/libprojectM +LIBDIR = $(PROJECTM_PREFIX)/lib +PROJECTM_LIBDIR ?= $(PROJECTM_PREFIX)/bin +PROJECTM_LIBNAME ?= projectM + +TARGET = projectM-cwrapper.dll +OBJECTS = projectM-cwrapper.o + +.PHONY: all clean + +all: $(TARGET) + +$(TARGET): $(OBJECTS) + $(CXX) -shared \ + $(LDFLAGS) -L$(LIBDIR) -L$(PROJECTM_LIBDIR) -o $@ $^ -l$(PROJECTM_LIBNAME) + +%.o: %.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $< -o $@ + +clean: + rm -f $(TARGET) $(OBJECTS) diff --git a/src/projectm.mk b/src/projectm.mk new file mode 100644 index 0000000000..f066b57ea7 --- /dev/null +++ b/src/projectm.mk @@ -0,0 +1,29 @@ +# This file is part of MXE. See LICENSE.md for licensing information. + +PKG := projectm +$(PKG)_WEBSITE := https://github.com/projectM-visualizer/projectm +$(PKG)_DESCR := projectM +$(PKG)_IGNORE := +$(PKG)_VERSION := 2.2.1 +$(PKG)_CHECKSUM := 9bbb33c5ba048537e97ea5ba2bd9fef76972c881597599a272b0194ec1d5f2a3 +$(PKG)_SUBDIR := projectM-$($(PKG)_VERSION) +$(PKG)_FILE := projectM-$($(PKG)_VERSION).tar.gz +$(PKG)_URL := https://github.com/projectM-visualizer/projectm/releases/download/v$($(PKG)_VERSION)/$($(PKG)_FILE) +$(PKG)_PATCHES := $(realpath $(sort $(wildcard $(addsuffix /projectm-[0-9]*.patch, $(TOP_DIR)/src)))) +$(PKG)_DEPS := cc zlib libpng libjpeg-turbo freetype-bootstrap dlfcn-win32 + +define $(PKG)_BUILD + cd '$(1)' && autoreconf -fi + cd '$(1)' && ./configure \ + $(MXE_CONFIGURE_OPTS) \ + --disable-sdl \ + --disable-qt \ + --disable-ftgl + $(MAKE) -C '$(1)' -j '$(JOBS)' install bin_PROGRAMS= sbin_PROGRAMS= noinst_PROGRAMS= + + # Windows convention: DLLs in bin/, not in lib/. + $(if $(BUILD_SHARED), \ + mv -fv '$(PREFIX)/$(TARGET)/lib/'libprojectM*.dll '$(PREFIX)/$(TARGET)/bin/' 2>/dev/null || true, \ + true + fi) +endef