Skip to content

Commit 375e92a

Browse files
committed
move the lateset mingw to Modern Version
The Lateset MinGW version has not supported windows7 or earlier.
1 parent 87611f1 commit 375e92a

File tree

4 files changed

+492
-77
lines changed

4 files changed

+492
-77
lines changed

Red_Panda_CPP.pro

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22
# | RedPandaIDE Version 3.4.0 Notice |
33
# | beta3 : (abandoned)Add zipped file support in ExtensionManager |
44
# | beta4 : Add the latest C++26 grammar support |
5-
# | RC1 : fix the bug of 'using namespace' |
6-
# | RC2 : Upload MinGW64 15.1.0 to installer(online) |
5+
# | RC1 : (abandoned)fix the bug of 'using namespace' |
6+
# | RC2 : (abandoned)Upload MinGW64 15.1.0 to installer(online) |
77
# | Release : Release the version if all tests passed |
88
# | |
99
# | Notice: the beta3 plan abandoned because the author can't find a library to unpack zip |
1010
# | file.This plan will join in v4.0.0, and just support in Modern Edition, because |
1111
# | we plan to use system command to unpack but win7 or earlier didn't support it. |
1212
# | In LightEdition, we plan to save theme and color scheme download support for it.|
13+
# | The RC1 version abandoned because it not easy to fix. |
14+
# | The RC2 version abandoned because it not support windows7 or earlier. |
1315
# +-----------------------------------------------------------------------------------------+
1416
# | RedPandaIDE Version 4.0.0 Notice |
1517
# | After v3.4.x, we'll release 4.0 version. |

packages/msys/build-mingw.sh

Lines changed: 24 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ set -euxo pipefail
44

55
ASTYLE_VERSION_TAG="3.6.9"
66

7-
# Print help information
87
function fn_print_help() {
98
echo " Usage:
109
packages/msys/build-mingw.sh [-m|--msystem <MSYSTEM>] [-c|--clean] [-nd|--no-deps] [-t|--target-dir <dir>]
@@ -24,17 +23,14 @@ function fn_print_help() {
2423
-nd, --no-deps Skip dependency check.
2524
-t, --target-dir <dir> Set target directory for the packages."
2625
}
27-
2826
source version.inc
2927
[[ -n "${APP_VERSION_SUFFIX}" ]] && APP_VERSION="${APP_VERSION}${APP_VERSION_SUFFIX}"
3028

31-
# Verify script is running in MSYS2 shell
3229
if [[ ! -v MSYSTEM ]]; then
3330
echo "This script must be run in MSYS2 shell"
3431
exit 1
3532
fi
3633

37-
# Handle MSYSTEM switch if specified
3834
if [[ $# -gt 1 && ($1 == "-m" || $1 == "--msystem") ]]; then
3935
msystem=$2
4036
shift 2
@@ -50,10 +46,9 @@ if [[ $# -gt 1 && ($1 == "-m" || $1 == "--msystem") ]]; then
5046
esac
5147
fi
5248

53-
# Set architecture-specific variables based on MSYSTEM
5449
case "${MSYSTEM}" in
5550
MINGW32)
56-
# No UCRT32 available
51+
# there is no UCRT32
5752
# CLANG32 qt5-static removed since 5.15.15
5853
# https://github.com/msys2/MINGW-packages/commit/ab062c6e5d6e9fff86ee8f88c1d8e9601ea9ab5b
5954
NSIS_ARCH=x86
@@ -76,7 +71,6 @@ case "${MSYSTEM}" in
7671
;;
7772
esac
7873

79-
# Initialize variables with default values
8074
CLEAN=0
8175
CHECK_DEPS=1
8276
compilers=()
@@ -88,8 +82,6 @@ REQUIRED_WINDOWS_BUILD=7600
8882
REQUIRED_WINDOWS_NAME="Windows 7"
8983
TARGET_DIR="$(pwd)/dist"
9084
UCRT=""
91-
92-
# Parse command line arguments
9385
while [[ $# -gt 0 ]]; do
9486
case $1 in
9587
-h|--help)
@@ -189,7 +181,6 @@ while [[ $# -gt 0 ]]; do
189181
esac
190182
done
191183

192-
# Define directory paths
193184
BUILD_DIR="${TEMP}/redpanda-mingw-${MSYSTEM}-build"
194185
ASTYLE_BUILD_DIR="${BUILD_DIR}/astyle"
195186
PACKAGE_DIR="${TEMP}/redpanda-mingw-${MSYSTEM}-pkg"
@@ -199,7 +190,6 @@ SOURCE_DIR="$(pwd)"
199190
ASSETS_DIR="${SOURCE_DIR}/assets"
200191
UCRT_DIR="/c/Program Files (x86)/Windows Kits/10/Redist/10.0.${UCRT}.0/ucrt/DLLs/${NSIS_ARCH}"
201192

202-
# Set 7-Zip path based on architecture
203193
case "${MSYSTEM}" in
204194
MINGW32)
205195
# 32-bit 7zip removed since 24.05
@@ -213,27 +203,22 @@ case "${MSYSTEM}" in
213203
;;
214204
esac
215205

216-
# MinGW32 configuration
217206
MINGW32_FOLDER="mingw32"
218207
MINGW32_ARCHIVE="mingw32.7z"
219208
MINGW32_COMPILER_NAME="MinGW-w64 i686 GCC 11.5"
220209
MINGW32_PACKAGE_SUFFIX="MinGW32_11.5"
221210

222-
# MinGW64 configuration with specified GitHub download link
223211
MINGW64_FOLDER="mingw64"
224-
MINGW64_ARCHIVE="x86_64-15.1.0-release-posix-seh-msvcrt-rt_v12-rev0_2.zip"
225-
MINGW64_URL="https://github.com/C14147/RedPandaIDE-Extensions/releases/download/mingw64-15.1-compilers/${MINGW64_ARCHIVE}"
226-
MINGW64_COMPILER_NAME="MinGW-w64 X86_64 GCC 15.1"
227-
MINGW64_PACKAGE_SUFFIX="MinGW64_15.1"
212+
MINGW64_ARCHIVE="mingw64.7z"
213+
MINGW64_COMPILER_NAME="MinGW-w64 X86_64 GCC 11.4"
214+
MINGW64_PACKAGE_SUFFIX="MinGW64_11.4"
228215

229-
# Linux compiler configurations
230216
GCC_LINUX_X8664_ARCHIVE="gcc-linux-x86-64.7z"
231217
ALPINE_X8664_ARCHIVE="alpine-minirootfs-x86_64.tar"
232218

233219
GCC_LINUX_AARCH64_ARCHIVE="gcc-linux-aarch64.7z"
234220
ALPINE_AARCH64_ARCHIVE="alpine-minirootfs-aarch64.tar"
235221

236-
# Set package base name based on selected compilers
237222
if [[ ${#compilers[@]} -eq 0 ]]; then
238223
PACKAGE_BASENAME="${PACKAGE_BASENAME}.NoCompiler"
239224
else
@@ -242,23 +227,21 @@ else
242227
[[ ${COMPILER_GCC_LINUX_X8664} -eq 1 || ${COMPILER_GCC_LINUX_AARCH64} -eq 1 ]] && PACKAGE_BASENAME="${PACKAGE_BASENAME}.Linux_GCC"
243228
fi
244229

245-
# Function to print formatted progress messages
246230
function fn_print_progress() {
247231
echo -e "\e[1;32;44m$1\e[0m"
248232
}
249233

250-
## Dependency check
234+
## check deps
235+
251236
if [[ ${CHECK_DEPS} -eq 1 ]]; then
252237
deps=(
253238
${MINGW_PACKAGE_PREFIX}-{cc,make,qt5-static,cmake}
254-
# Always use x86 NSIS to display architecture mismatch errors
239+
# always use x86 NSIS to display error message of mismatched architecture
255240
mingw-w64-i686-nsis
256241
${_7Z_PACKAGE_PREFIX}-7zip
257242
git
258-
curl # Ensure curl is installed for downloading MinGW64
259243
)
260244

261-
# Verify all dependencies are installed
262245
for dep in ${deps[@]}; do
263246
pacman -Q ${dep} &>/dev/null || {
264247
echo "Missing dependency: ${dep}"
@@ -267,13 +250,14 @@ if [[ ${CHECK_DEPS} -eq 1 ]]; then
267250
done
268251
fi
269252

270-
# Check for MinGW32 assets if needed
271253
if [[ ${COMPILER_MINGW32} -eq 1 && ! -f "${SOURCE_DIR}/assets/${MINGW32_ARCHIVE}" && ! -d "${SOURCE_DIR}/assets/${MINGW32_FOLDER}" ]]; then
272254
echo "Missing MinGW archive: assets/${MINGW32_ARCHIVE} or MinGW folder: assets/${MINGW32_FOLDER}"
273255
exit 1
274256
fi
275-
276-
# Check for Linux compiler assets if needed
257+
if [[ ${COMPILER_MINGW64} -eq 1 && ! -f "${SOURCE_DIR}/assets/${MINGW64_ARCHIVE}" && ! -d "${SOURCE_DIR}/assets/${MINGW64_FOLDER}" ]]; then
258+
echo "Missing MinGW archive: assets/${MINGW64_ARCHIVE} or MinGW folder: assets/${MINGW64_FOLDER}"
259+
exit 1
260+
fi
277261
if [[ ${COMPILER_GCC_LINUX_X8664} -eq 1 ]]; then
278262
if [[ ! -f "${SOURCE_DIR}/assets/${GCC_LINUX_X8664_ARCHIVE}" ]]; then
279263
echo "Missing GCC archive: assets/${GCC_LINUX_X8664_ARCHIVE}"
@@ -282,7 +266,6 @@ if [[ ${COMPILER_GCC_LINUX_X8664} -eq 1 ]]; then
282266
echo "Missing Alpine rootfs: assets/${ALPINE_X8664_ARCHIVE}"
283267
fi
284268
fi
285-
286269
if [[ ${COMPILER_GCC_LINUX_AARCH64} -eq 1 ]]; then
287270
if [[ ! -f "${SOURCE_DIR}/assets/${GCC_LINUX_AARCH64_ARCHIVE}" ]]; then
288271
echo "Missing GCC archive: assets/${GCC_LINUX_AARCH64_ARCHIVE}"
@@ -291,21 +274,21 @@ if [[ ${COMPILER_GCC_LINUX_AARCH64} -eq 1 ]]; then
291274
echo "Missing Alpine rootfs: assets/${ALPINE_AARCH64_ARCHIVE}"
292275
fi
293276
fi
294-
295-
# Check for UCRT if specified
296277
if [[ -n "${UCRT}" && ! -f "${UCRT_DIR}/ucrtbase.dll" ]]; then
297278
echo "Missing Windows SDK, UCRT cannot be included."
298279
exit 1
299280
fi
300281

301-
## Prepare directories
282+
## prepare dirs
283+
302284
if [[ ${CLEAN} -eq 1 ]]; then
303285
rm -rf "${BUILD_DIR}"
304286
rm -rf "${PACKAGE_DIR}"
305287
fi
306288
mkdir -p "${BUILD_DIR}" "${PACKAGE_DIR}" "${TARGET_DIR}" "${ASTYLE_BUILD_DIR}" "${ASSETS_DIR}"
307289

308-
## Prepare assets
290+
## prepare assets
291+
309292
fn_print_progress "Updating astyle repo..."
310293
if [[ ! -d "${ASSETS_DIR}/astyle" ]]; then
311294
git clone --bare "https://gitlab.com/saalen/astyle" "${ASSETS_DIR}/astyle"
@@ -316,7 +299,7 @@ if [[ -z "$(git tag -l ${ASTYLE_VERSION_TAG})" ]]; then
316299
fi
317300
popd
318301

319-
## Build astyle
302+
## build
320303
fn_print_progress "Building astyle..."
321304
pushd "${ASSETS_DIR}/astyle"
322305
git --work-tree="${ASTYLE_BUILD_DIR}" checkout -f "${ASTYLE_VERSION_TAG}"
@@ -329,7 +312,6 @@ mingw32-make -j$(nproc)
329312
cp AStyle/AStyle.exe "${PACKAGE_DIR}/astyle.exe"
330313
popd
331314

332-
## Build main application
333315
fn_print_progress "Building..."
334316
pushd .
335317
cd "${BUILD_DIR}"
@@ -340,7 +322,8 @@ mingw32-make -j$(nproc)
340322
mingw32-make install
341323
popd
342324

343-
## Prepare packaging resources
325+
## prepare packaging resources
326+
344327
pushd .
345328
cd "${PACKAGE_DIR}"
346329

@@ -360,15 +343,15 @@ mkdir -p "${SEVENZIP_DIR}"
360343
"${_7Z}" x -y "${SEVENZIP_ZIP}" -o"${SEVENZIP_DIR}"
361344
rm "${SEVENZIP_ZIP}"
362345

363-
## Create package
346+
## make package
347+
364348
pushd .
365349
cd "${PACKAGE_DIR}"
366350
SETUP_NAME="${PACKAGE_BASENAME}.Setup.exe"
367351
PORTABLE_NAME="${PACKAGE_BASENAME}.Portable.7z"
368352

369353
fn_print_progress "Making installer..."
370354

371-
# NSIS compiler flags
372355
nsis_flags=(
373356
-DAPP_VERSION="${APP_VERSION}"
374357
-DARCH="${NSIS_ARCH}"
@@ -379,56 +362,29 @@ nsis_flags=(
379362
-DREQUIRED_WINDOWS_NAME="${REQUIRED_WINDOWS_NAME}"
380363
-DUSE_MODERN_FONT
381364
)
382-
383-
# Handle MinGW32 if selected
384365
if [[ ${COMPILER_MINGW32} -eq 1 ]]; then
385366
nsis_flags+=(-DHAVE_MINGW32)
386367
if [[ ! -d "mingw32" ]]; then
387368
[[ -f "${SOURCE_DIR}/assets/${MINGW32_ARCHIVE}" ]] && "${_7Z}" x "${SOURCE_DIR}/assets/${MINGW32_ARCHIVE}" -o"${PACKAGE_DIR}"
388369
[[ -d "${SOURCE_DIR}/assets/${MINGW32_FOLDER}" ]] && cp -a --dereference "${SOURCE_DIR}/assets/${MINGW32_FOLDER}" "${PACKAGE_DIR}"
389370
fi
390371
fi
391-
392-
# Handle MinGW64 if selected - download from specified URL
393372
if [[ ${COMPILER_MINGW64} -eq 1 ]]; then
394373
nsis_flags+=(-DHAVE_MINGW64)
395374
if [[ ! -d "mingw64" ]]; then
396-
# Download if not already downloaded
397-
if [[ ! -f "${BUILD_DIR}/${MINGW64_ARCHIVE}" ]]; then
398-
fn_print_progress "Downloading MinGW64 from ${MINGW64_URL}..."
399-
# Download MinGW64 package
400-
if ! curl -L -o "${BUILD_DIR}/${MINGW64_ARCHIVE}" "${MINGW64_URL}"; then
401-
echo "Error: Failed to download MinGW64 from ${MINGW64_URL}"
402-
exit 1
403-
fi
404-
fi
405-
406-
# Extract the downloaded package
407-
fn_print_progress "Extracting MinGW64 archive..."
408-
if ! "${_7Z}" x "${BUILD_DIR}/${MINGW64_ARCHIVE}" -o"${PACKAGE_DIR}"; then
409-
echo "Error: Failed to extract MinGW64 archive"
410-
exit 1
411-
fi
412-
413-
# Ensure directory is named mingw64
414-
if [[ -d "${PACKAGE_DIR}/x86_64-15.1.0-release-posix-seh-msvcrt-rt_v12-rev0" && ! -d "mingw64" ]]; then
415-
mv "${PACKAGE_DIR}/x86_64-15.1.0-release-posix-seh-msvcrt-rt_v12-rev0" "${PACKAGE_DIR}/mingw64"
416-
fi
375+
[[ -f "${SOURCE_DIR}/assets/${MINGW64_ARCHIVE}" ]] && "${_7Z}" x "${SOURCE_DIR}/assets/${MINGW64_ARCHIVE}" -o"${PACKAGE_DIR}"
376+
[[ -d "${SOURCE_DIR}/assets/${MINGW64_FOLDER}" ]] && cp -a --dereference "${SOURCE_DIR}/assets/${MINGW64_FOLDER}" "${PACKAGE_DIR}"
417377
fi
418378
fi
419-
420-
# Handle Linux x86_64 compiler if selected
421379
if [[ ${COMPILER_GCC_LINUX_X8664} -eq 1 ]]; then
422380
nsis_flags+=(-DHAVE_GCC_LINUX_X8664 -DSTRICT_ARCH_CHECK)
423-
if [[ ! -d "gcc-linux-x86-64" ]]; then
381+
if [[ ! -d "gcc-linux-x86_64" ]]; then
424382
"${_7Z}" x "${SOURCE_DIR}/assets/${GCC_LINUX_X8664_ARCHIVE}" -o"${PACKAGE_DIR}"
425383
fi
426384
if [[ ! -d "alpine-minirootfs.tar" ]]; then
427385
cp "${SOURCE_DIR}/assets/${ALPINE_X8664_ARCHIVE}" alpine-minirootfs.tar
428386
fi
429387
fi
430-
431-
# Handle Linux aarch64 compiler if selected
432388
if [[ ${COMPILER_GCC_LINUX_AARCH64} -eq 1 ]]; then
433389
nsis_flags+=(-DHAVE_GCC_LINUX_AARCH64 -DSTRICT_ARCH_CHECK)
434390
if [[ ! -d "gcc-linux-aarch64" ]]; then
@@ -438,26 +394,20 @@ if [[ ${COMPILER_GCC_LINUX_AARCH64} -eq 1 ]]; then
438394
cp "${SOURCE_DIR}/assets/${ALPINE_AARCH64_ARCHIVE}" alpine-minirootfs.tar
439395
fi
440396
fi
441-
442-
# Handle UCRT if specified
443397
if [[ -n "${UCRT}" ]]; then
444398
nsis_flags+=(-DHAVE_UCRT)
445399
if [[ ! -f ucrt/ucrtbase.dll ]]; then
446400
mkdir -p ucrt
447401
cp "${UCRT_DIR}"/*.dll ucrt
448402
fi
449403
fi
450-
451-
# Build installer
452404
"${NSIS}" "${nsis_flags[@]}" redpanda.nsi
453405

454-
# Create portable package
455406
fn_print_progress "Making Portable Package..."
456407
"${_7Z}" x "${SETUP_NAME}" -o"RedPanda-CPP" -xr'!$PLUGINSDIR' -x"!uninstall.exe"
457408
"${_7Z}" a -mmt -mx9 -ms=on -mqs=on -mf=BCJ2 "${PORTABLE_NAME}" "RedPanda-CPP"
458409
rm -rf "RedPanda-CPP"
459410

460-
# Move final packages to target directory
461411
mv "${SETUP_NAME}" "${TARGET_DIR}"
462412
mv "${PORTABLE_NAME}" "${TARGET_DIR}"
463-
popd
413+
popd

0 commit comments

Comments
 (0)