Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
/wip/
/tmp-*
/.ccache
/DLLs/

# generated by cmake projects
CMakeCache.txt
Expand Down
73 changes: 61 additions & 12 deletions build.sh
Original file line number Diff line number Diff line change
@@ -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
32 changes: 14 additions & 18 deletions src/gcc-1-fixes.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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 <stdio.h>
+
+#include <stdio.h>
+#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 *, ...)
Expand All @@ -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 *, ...)
Expand Down
26 changes: 0 additions & 26 deletions src/gcc-2-stabs.patch

This file was deleted.

7 changes: 5 additions & 2 deletions src/gcc.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
11 changes: 9 additions & 2 deletions src/libjpeg-turbo.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
46 changes: 39 additions & 7 deletions src/opencv.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand All @@ -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
19 changes: 19 additions & 0 deletions src/opencvwrapper.mk
Original file line number Diff line number Diff line change
@@ -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
Loading