Skip to content

Commit 2e40c27

Browse files
committed
switch to msys2
1 parent 34a2346 commit 2e40c27

2 files changed

Lines changed: 35 additions & 17 deletions

File tree

nsis/INIfiles/devkitProUpdate.ini

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ Build=50
33
URL=https://downloads.devkitpro.org
44
Filename=devkitProUpdater-2.1.1.exe
55

6-
[msys]
7-
Version=1.0.17-1
8-
File=msys-1.0.17-1.exe
6+
[msys2]
7+
Version=2.10.0
8+
File=msys-2.10.0.7z
99
Size=118660
1010

1111
[devkitARM]

nsis/devkitPro.nsi

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ SetCompressor /SOLID lzma
2929
!include "Sections.nsh"
3030
!include "StrFunc.nsh"
3131
!include "InstallOptions.nsh"
32+
!include "ReplaceInFile.nsh"
33+
!include NTProfiles.nsh
3234

3335
;${StrTok}
3436
${StrRep}
@@ -161,8 +163,8 @@ ShowUnInstDetails show
161163

162164
var Install
163165
var Updating
164-
var MSYS
165-
var MSYS_VER
166+
var MSYS2
167+
var MSYS2_VER
166168

167169
var DEVKITARM
168170
var DEVKITARM_VER
@@ -351,7 +353,7 @@ Section -installComponents
351353
StrCpy $BASEDIR /$R0$R1
352354

353355
push ${SecMsys}
354-
push $MSYS
356+
push $MSYS2
355357
Call DownloadIfNeeded
356358

357359
push ${SecdkARM}
@@ -468,14 +470,25 @@ Section -installComponents
468470

469471
test_Msys:
470472
!insertmacro SectionFlagIsSet ${SecMsys} ${SF_SELECTED} install_Msys SkipMsys
473+
471474
install_Msys:
475+
; Set output path to the installation directory.
476+
SetOutPath $INSTDIR
477+
SetDetailsPrint both
472478

473-
ExecWait '"$EXEDIR\$MSYS" -y -o$INSTDIR'
474-
WriteINIStr $INSTDIR\installed.ini msys Version $MSYS_VER
475-
push $MSYS
479+
Nsis7z::ExtractWithDetails "$EXEDIR\$MSYS2" "Installing package %s..."
480+
WriteINIStr $INSTDIR\installed.ini msys2 Version $MSYS2_VER
481+
push $MSYS2
476482
call RemoveFile
477483

478484
SkipMsys:
485+
486+
!insertmacro _ReplaceInFile "$INSTDIR\msys2\etc\fstab" "{DEVKITPRO}" "$INSTDIR"
487+
488+
${ProfilesPath} $0
489+
!insertmacro _ReplaceInFile "$INSTDIR\msys2\etc\fstab" "{PROFILES_ROOT}" "$0"
490+
491+
479492
push ${SecdkARM}
480493
push "DEVKITARM"
481494
push $DEVKITARM
@@ -682,12 +695,15 @@ skip_copy:
682695
SetShellVarContext all ; Put stuff in All Users
683696
SetOutPath $INSTDIR
684697
IntCmp $Updating 1 CheckPN2
698+
685699
WriteIniStr "$INSTDIR\devkitPro.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
686700
CreateDirectory "$SMPROGRAMS\$ICONS_GROUP"
687701
CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\devkitpro.lnk" "$INSTDIR\devkitPro.url"
688702
CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Uninstall.lnk" "$INSTDIR\uninst.exe"
689-
SetOutPath $INSTDIR\msys\bin
690-
CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\MSys.lnk" "$INSTDIR\msys\msys.bat" "-norxvt" "$INSTDIR\msys\m.ico"
703+
704+
SetOutPath $INSTDIR\msys2
705+
CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\MSys.lnk" "$INSTDIR\msys2\msys2_shell.cmd" "" "$INSTDIR\msys2\msys2.ico"
706+
691707
CheckPN2:
692708
!insertmacro SectionFlagIsSet ${Pnotepad} ${SF_SELECTED} +1 SkipPN2Menu
693709
SetOutPath "$INSTDIR\Programmers Notepad"
@@ -712,13 +728,14 @@ SkipInstall:
712728
ReadRegStr $1 HKLM "System\CurrentControlSet\Control\Session Manager\Environment" "PATH"
713729
; remove it to avoid multiple paths with separate installs
714730
${StrRep} $2 $1 "$INSTDIR\msys\bin;" ""
731+
${StrRep} $2 $2 "$INSTDIR\msys2\usr\bin;" ""
715732
StrCmp $2 "" 0 WritePath
716733

717734
MessageBox mb_IconStop|mb_TopMost|mb_SetForeground "Trying to set path to blank string!$\nPlease add $INSTDIR\msys\bin; to the start of your path"
718735
goto AbortPath
719736

720737
WritePath:
721-
StrCpy $2 "$INSTDIR\msys\bin;$2"
738+
StrCpy $2 "$INSTDIR\msys2\usr\bin;$2"
722739
WriteRegExpandStr HKLM "System\CurrentControlSet\Control\Session Manager\Environment" "PATH" $2
723740
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
724741
AbortPath:
@@ -736,6 +753,7 @@ Section Uninstall
736753

737754
ReadRegStr $1 HKLM "System\CurrentControlSet\Control\Session Manager\Environment" "PATH"
738755
${UnStrRep} $1 $1 "$INSTDIR\msys\bin;" ""
756+
${UnStrRep} $1 $1 "$INSTDIR\msys2\usr\bin;" ""
739757
WriteRegExpandStr HKLM "System\CurrentControlSet\Control\Session Manager\Environment" "PATH" $1
740758
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
741759

@@ -880,9 +898,9 @@ gotINI:
880898

881899
installing:
882900

883-
ReadINIStr $R0 "$EXEDIR\devkitProUpdate.ini" "msys" "Size"
884-
ReadINIStr $MSYS "$EXEDIR\devkitProUpdate.ini" "msys" "File"
885-
ReadINIStr $MSYS_VER "$EXEDIR\devkitProUpdate.ini" "msys" "Version"
901+
ReadINIStr $R0 "$EXEDIR\devkitProUpdate.ini" "msys2" "Size"
902+
ReadINIStr $MSYS2 "$EXEDIR\devkitProUpdate.ini" "msys2" "File"
903+
ReadINIStr $MSYS2_VER "$EXEDIR\devkitProUpdate.ini" "msys2" "Version"
886904
SectionSetSize ${SecMsys} $R0
887905

888906
ReadINIStr $R0 "$EXEDIR\devkitProUpdate.ini" "devkitARM" "Size"
@@ -1121,8 +1139,8 @@ installing:
11211139

11221140
dkARMupdates:
11231141

1124-
push "msys"
1125-
push $MSYS_VER
1142+
push "msys2"
1143+
push $MSYS2_VER
11261144
push ${SecMsys}
11271145
call checkVersion
11281146

0 commit comments

Comments
 (0)