forked from mpc-qt/mpc-qt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake-release-msys2.sh
110 lines (92 loc) · 3.05 KB
/
make-release-msys2.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#!/usr/bin/bash
# Like make-release-win.sh, but everything comes from the msys2 installation
set -e
VERSION=""
if [ -v FORCE_VERSION ]; then
if [[ $FORCE_VERSION == "GithubAction" ]]; then
VERSION=`date +'%Y.%m.%d'`
else
VERSION=$FORCE_VERSION
fi
else
# v23.02-74-g60b18fa -> 23.02.74
VERSION=`git describe --tags | sed 's/[^0-9]*\([0-9]*\)[^0-9]*\([0-9]*\)[^0-9]*\([0-9]*\).*/\1.\2.\3/'`
fi
BUILD=release
EXECUTABLE="$BUILD/mpc-qt.exe"
BINDIR="/mingw64/bin"
SUFFIX="win-x64-$VERSION"
DEST="mpc-qt-$SUFFIX"
qmake6 "MPCQT_VERSION=$VERSION" "ENABLE_LOCAL_MPV=1" mpc-qt.pro
mkdir -p $BUILD
rm $BUILD/*
make $BUILD-clean
if [ -v GITHUB_SHA ]; then
make $BUILD
else
make -j`nproc` $BUILD
fi
if [ ! -f "$EXECUTABLE" ]; then
echo Failed to find executable
exit 1
fi
echo Making directories
mkdir -p "$DEST"
mkdir -p "$DEST/doc"
mkdir -p "$DEST/iconengines"
mkdir -p "$DEST/imageformats"
mkdir -p "$DEST/platforms"
mkdir -p "$DEST/styles"
echo Copying documents
cp DOCS/ipc.md "$DEST/doc"
echo Copying plugins
PLUGDIR=/mingw64/share/qt6/plugins
cp "$PLUGDIR/iconengines/qsvgicon.dll" "$DEST/iconengines"
cp "$PLUGDIR/imageformats/qjpeg.dll" "$DEST/imageformats"
cp "$PLUGDIR/imageformats/qsvg.dll" "$DEST/imageformats"
cp "$PLUGDIR/platforms/qdirect2d.dll" "$DEST/platforms"
cp "$PLUGDIR/platforms/qminimal.dll" "$DEST/platforms"
cp "$PLUGDIR/platforms/qoffscreen.dll" "$DEST/platforms"
cp "$PLUGDIR/platforms/qwindows.dll" "$DEST/platforms"
cp "$PLUGDIR/styles/qmodernwindowsstyle.dll" "$DEST/styles"
# Use ldd to find dependencies and copy them
ldd "$EXECUTABLE" | awk '/=>/ {print $3}' | while read -r dll; do
if [[ -n "$dll" && -f "$dll" ]]; then
# Check if the DLL is in /mingw64/bin before copying
if [[ "$dll" == "$BINDIR"* ]]; then
echo "Copying $dll to $DEST"
cp -u "$dll" "$DEST"
else
echo "Skipping $dll (not in $BINDIR)"
fi
fi
done
DLLS=("Qt6Core.dll" "Qt6Gui.dll" "Qt6Network.dll" "Qt6OpenGLWidgets.dll")
for dll in "${DLLS[@]}"; do
echo " "
echo "Checking dependencies for $dll"
ldd "$BINDIR/$dll" | awk '/=>/ {print $3}' | while read -r dep; do
if [[ -n "$dep" && -f "$dep" ]]; then
# Check if the DLL is in /mingw64/bin before copying
if [[ "$dep" == "$BINDIR"* ]]; then
echo "Copying $dep to $DEST"
cp -u "$dep" "$DEST"
else
echo "Skipping $dep (not in $BINDIR)"
fi
fi
done
done
# Manually copy Qt6Svg.dll as it's needed by imageformats/qjpeg.dll
echo "Copying libjpeg-*.dll to $DEST"
cp $BINDIR/libjpeg-*.dll "$DEST"
echo "All required DLLs from $BINDIR have been copied to $DEST."
echo Copying executable
cp "$BUILD/mpc-qt.exe" "$DEST"
echo Copying libmpv
cp mpv-dev/lib/libmpv-2.dll "$DEST"
echo Copying yt-dlp
cp "yt-dlp.exe" "$DEST"
echo Zipping and checksumming
7z a "$DEST.zip" "./$DEST/*"
sha512sum "$DEST.zip" >"$DEST.zip.sha512"