From 64972b5b34aec9473a90c7501f53cd5d4826231d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Malte=20J=C3=BCrgens?= Date: Wed, 19 Jan 2022 20:43:40 +0000 Subject: [PATCH] Update NSIS to use a more modern style and detect if LibreWolf is still running --- assets/banner.bmp | Bin 0 -> 154542 bytes assets/setup.nsi | 283 +++++++++++++++++------------- common | 1 + mk.py | 434 +++++++++++++++++++++++----------------------- settings | 1 + 5 files changed, 379 insertions(+), 340 deletions(-) create mode 100644 assets/banner.bmp create mode 160000 common mode change 100755 => 100644 mk.py create mode 160000 settings diff --git a/assets/banner.bmp b/assets/banner.bmp new file mode 100644 index 0000000000000000000000000000000000000000..05fda40b27db5620b47b8a50d79582de81537a09 GIT binary patch literal 154542 zcmeI52aqL28OQH1hto0^WvQ4&RLn@Jl!^fnDN{)ypr9xMDuNVZMkQ#eC@99lDitGM z4tslhx0m*E&iRgm%X>MncY9&m|L~5vo}TG`^LFR$ZoT<+?N;^7>+b3KeKS4X{eAuQ z`4i-}5f7ieP0|pK_U9n17IcUIu=>PFx2oQh(1Rwwb2tWV=5P$## zAOHafKmY;|fB*y_009U<00Izz00bZa0SG_<0uX=z1Rwwb2tWV=5P$##AOHafKmY;| zfB*y_009U<00Izz00bZa0SG_<0uX=z1Rwwb2tWV=5P$##AOHafKmY;|fB*y_009U< z00Izz00bZa0SG_<0uX=z1Rwwb2tWV=5P$##AOHafKmY;|fB*y_009U<00Izz00bZa z0SG_<0uX=z1Rwwb2tWV=5P$##AOHafKmY;|fB*y_009U<00Izz00bZa0SG_<0uX=z z1Rwwb2tWV=5P$##AOHafKmY;|fB*y_009U<00Izz00bZa0SG_<0uX=z1Rwwb2tWV= z5P$##AOHafKmY;|fB*y_0D;~l&~?Hb+G)10H0vjuMgKHycbG}HnwD$K=!?v-v!Xvm zbf}a1NePrpiIqhe3H_fyS63vgO>@os`_0G?nZX0P^Ecw%X6D^y{S>o*n^A#;{zgC| zUe#opF6oYN1CNB>{Ur~Yy_@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WV=5P$##AOHaf zKmY;|fB*y_009U<00Izz00bZa0SG_<0uX=z1Rwwb2tWV=5P$##AOHafKmY;|fB*y_ z009U<00Izz00bZa0SG_<0uX=z1Rwwb2tWV=5P$##AOHafKmY;|fB*y_009U<00Izz z00bZa0SG_<0uX=z1Rwwb2tWV=5P$##AOHafKmY;|fB*y_009U<00Izz00bZa0SG_< z0uX=z1Rwwb2tWV=5P$##AOHafKmY;|fB*y_009U<00Izz00bZa0SG_<0uX=z1Rwwb o2tWV=5P$##AOHafKmY;|fB*y_009U<00Izz00bZafd(S*e{T{v+5i9m literal 0 HcmV?d00001 diff --git a/assets/setup.nsi b/assets/setup.nsi index 3448471..c2ba517 100644 --- a/assets/setup.nsi +++ b/assets/setup.nsi @@ -1,125 +1,158 @@ -# -# Change these values to fit your application... -# - -!define APPNAME "LibreWolf" # Full app name, like: "Gtk+ 2.0 Hello World" -!define PROGNAME "librewolf" # executable name, like: gtk2hello -!define PROG_VERSION "pkg_version" # the program version, like: 0.3.0 -!define ICON_NAME "librewolf.ico" # filename of icon to use for this app -!define COMPANYNAME "LibreWolf" # Your name, or company (or just the program name) -!define ESTIMATED_SIZE 190000 # Estimated size (in KB) of installed program for use in "add or remove programs" / 190 MB - -# -# The actual installer/uninstaller, you should not need to change much here below -# - -Name "${PROGNAME}" -OutFile "${PROGNAME}-${PROG_VERSION}.en-US.win64-setup.exe" -InstallDir $PROGRAMFILES64\${APPNAME} -RequestExecutionLevel admin - -Page directory -Page instfiles - -function .onInit - setShellVarContext all -functionEnd - -Section "${PROGNAME}" - - # Copy files - SetOutPath $INSTDIR - File /r librewolf\*.* - - # Start Menu - createDirectory "$SMPROGRAMS\${COMPANYNAME}" - createShortCut "$SMPROGRAMS\${COMPANYNAME}\${APPNAME}.lnk" "$INSTDIR\${PROGNAME}.exe" "" "$INSTDIR\${ICON_NAME}" - createShortCut "$SMPROGRAMS\${COMPANYNAME}\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "" - - # Uninstaller - writeUninstaller "$INSTDIR\uninstall.exe" - - # Registry information for add/remove programs - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayName" "${APPNAME}" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\"" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "InstallLocation" "$\"$INSTDIR$\"" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayIcon" "$\"$INSTDIR\${ICON_NAME}$\"" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "Publisher" "${COMPANYNAME}" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayVersion" "${PROG_VERSION}" - # There is no option for modifying or repairing the install - WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "NoModify" 1 - WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "NoRepair" 1 - # Set the INSTALLSIZE constant (!defined at the top of this script) so Add/Remove Programs can accurately report the size - WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "EstimatedSize" ${ESTIMATED_SIZE} - - - # - # Registry information to let Windows pick us up in the list of available browsers - # - - WriteRegStr HKLM "Software\Clients\StartMenuInternet\LibreWolf" "" "LibreWolf" - - WriteRegStr HKLM "Software\Clients\StartMenuInternet\LibreWolf\Capabilities" "ApplicationDescription" "LibreWolf" - WriteRegStr HKLM "Software\Clients\StartMenuInternet\LibreWolf\Capabilities" "ApplicationIcon" "$INSTDIR\librewolf.exe,0" - WriteRegStr HKLM "Software\Clients\StartMenuInternet\LibreWolf\Capabilities" "ApplicationName" "LibreWolf" - WriteRegStr HKLM "Software\Clients\StartMenuInternet\LibreWolf\Capabilities\FileAssociations" ".htm" "LibreWolfHTM" - WriteRegStr HKLM "Software\Clients\StartMenuInternet\LibreWolf\Capabilities\FileAssociations" ".html" "LibreWolfHTM" - WriteRegStr HKLM "Software\Clients\StartMenuInternet\LibreWolf\Capabilities\FileAssociations" ".pdf" "LibreWolfHTM" - WriteRegStr HKLM "Software\Clients\StartMenuInternet\LibreWolf\Capabilities\Startmenu" "StartMenuInternet" "LibreWolf" - WriteRegStr HKLM "Software\Clients\StartMenuInternet\LibreWolf\Capabilities\URLAssociations" "http" "LibreWolfHTM" - WriteRegStr HKLM "Software\Clients\StartMenuInternet\LibreWolf\Capabilities\URLAssociations" "https" "LibreWolfHTM" - - WriteRegStr HKLM "Software\Clients\StartMenuInternet\LibreWolf\DefaultIcon" "" "$INSTDIR\librewolf.exe,0" - WriteRegStr HKLM "Software\Clients\StartMenuInternet\LibreWolf\shell\open\command" "" "$INSTDIR\librewolf.exe" - - WriteRegStr HKLM "Software\RegisteredApplications" "LibreWolf" "Software\Clients\StartMenuInternet\LibreWolf\Capabilities" - - WriteRegStr HKLM "Software\Classes\LibreWolfHTM" "" "LibreWolf Handler" - WriteRegStr HKLM "Software\Classes\LibreWolfHTM" "AppUserModelId" "LibreWolf" - WriteRegStr HKLM "Software\Classes\LibreWolfHTM\Application" "AppUserModelId" "LibreWolf" - WriteRegStr HKLM "Software\Classes\LibreWolfHTM\Application" "ApplicationIcon" "$INSTDIR\librewolf.exe,0" - WriteRegStr HKLM "Software\Classes\LibreWolfHTM\Application" "ApplicationName" "LibreWolf" - WriteRegStr HKLM "Software\Classes\LibreWolfHTM\Application" "ApplicationDescription" "Start the LibreWolf Browser" - WriteRegStr HKLM "Software\Classes\LibreWolfHTM\Application" "ApplicationCompany" "LibreWolf Community" - WriteRegStr HKLM "Software\Classes\LibreWolfHTM\DefaultIcon" "" "$INSTDIR\librewolf.exe,0" - WriteRegStr HKLM "Software\Classes\LibreWolfHTM\shell\open\command" "" "$INSTDIR\librewolf.exe %1" - -SectionEnd - -# Before uninstall, ask for confirmation -function un.onInit - SetShellVarContext all - - # Verify the uninstaller - last chance to back out - # (commented this out, it causes problems with Chocolatey.) - # MessageBox MB_OKCANCEL "Permanantly remove ${APPNAME}?" IDOK next - # Abort - # next: - -functionEnd - -# Uninstaller -section "uninstall" - - # Remove Start Menu launcher - delete "$SMPROGRAMS\${COMPANYNAME}\${APPNAME}.lnk" - delete "$SMPROGRAMS\${COMPANYNAME}\Uninstall.lnk" - # Try to remove the Start Menu folder - this will only happen if it is empty - rmDir "$SMPROGRAMS\${COMPANYNAME}" - - # Remove files - rmDir /r $INSTDIR - - # Remove uninstaller information from the registry - DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" - - # - # Windows default browser integration - # - - DeleteRegKey HKLM "Software\Clients\StartMenuInternet\LibreWolf" - DeleteRegKey HKLM "Software\RegisteredApplications" - DeleteRegKey HKLM "Software\Classes\LibreWolfHTM" - -sectionEnd +!include "MUI2.nsh" +!include "LogicLib.nsh" +!addplugindir . + +!define APPNAME "LibreWolf" +!define PROGNAME "librewolf" +!define EXECUTABLE "${PROGNAME}.exe" +!define PROG_VERSION "pkg_version" +!define COMPANYNAME "LibreWolf" +!define ESTIMATED_SIZE 190000 +!define MUI_ICON "librewolf.ico" +!define MUI_WELCOMEFINISHPAGE_BITMAP "banner.bmp" + +Name "${APPNAME}" +OutFile "${PROGNAME}-${PROG_VERSION}.en-US.win64-setup.exe" +InstallDir $PROGRAMFILES64\${APPNAME} +RequestExecutionLevel admin + +# Pages + +!define MUI_ABORTWARNING + +!insertmacro MUI_PAGE_WELCOME +!insertmacro MUI_PAGE_DIRECTORY +!insertmacro MUI_PAGE_INSTFILES +!insertmacro MUI_PAGE_FINISH + +!insertmacro MUI_UNPAGE_CONFIRM +!insertmacro MUI_UNPAGE_INSTFILES + +!insertmacro MUI_LANGUAGE "English" + +Section + + # Make sure LibreWolf is closed before the installation + nsProcess::_FindProcess "${EXECUTABLE}" + Pop $R0 + ${If} $R0 = 0 + IfSilent 0 +4 + DetailPrint "${APPNAME} is still running, aborting because of silent install." + SetErrorlevel 2 + Abort + + DetailPrint "${APPNAME} is still running. Closing it gracefully..." + nsProcess::_CloseProcess "${EXECUTABLE}" + Pop $R0 + Sleep 2000 + nsProcess::_FindProcess "${EXECUTABLE}" + Pop $R0 + ${If} $R0 = 0 + DetailPrint "Failed to close ${APPNAME}, killing it..." + nsProcess::_KillProcess "${EXECUTABLE}" + Sleep 2000 + nsProcess::_FindProcess "${EXECUTABLE}" + Pop $R0 + ${If} $R0 = 0 + DetailPrint "Failed to kill ${APPNAME}, aborting" + MessageBox MB_ICONSTOP "LibreWolf is still running and can't be closed by the installer. Please close it manually and try again." + SetErrorlevel 2 + Abort + ${EndIf} + ${EndIf} + ${EndIf} + + # Copy files + SetOutPath $INSTDIR + File /r librewolf\*.* + + # Start Menu + createDirectory "$SMPROGRAMS\${COMPANYNAME}" + createShortCut "$SMPROGRAMS\${COMPANYNAME}\${APPNAME}.lnk" "$INSTDIR\${PROGNAME}.exe" "" "$INSTDIR\${MUI_ICON}" + createShortCut "$SMPROGRAMS\${COMPANYNAME}\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "" + + # Uninstaller + writeUninstaller "$INSTDIR\uninstall.exe" + + # Registry information for add/remove programs + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayName" "${APPNAME}" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\"" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "InstallLocation" "$\"$INSTDIR$\"" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayIcon" "$\"$INSTDIR\${MUI_ICON}$\"" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "Publisher" "${COMPANYNAME}" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayVersion" "${PROG_VERSION}" + # There is no option for modifying or repairing the install + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "NoModify" 1 + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "NoRepair" 1 + # Set the INSTALLSIZE constant (!defined at the top of this script) so Add/Remove Programs can accurately report the size + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "EstimatedSize" ${ESTIMATED_SIZE} + + + # + # Registry information to let Windows pick us up in the list of available browsers + # + + WriteRegStr HKLM "Software\Clients\StartMenuInternet\LibreWolf" "" "LibreWolf" + + WriteRegStr HKLM "Software\Clients\StartMenuInternet\LibreWolf\Capabilities" "ApplicationDescription" "LibreWolf" + WriteRegStr HKLM "Software\Clients\StartMenuInternet\LibreWolf\Capabilities" "ApplicationIcon" "$INSTDIR\librewolf.exe,0" + WriteRegStr HKLM "Software\Clients\StartMenuInternet\LibreWolf\Capabilities" "ApplicationName" "LibreWolf" + WriteRegStr HKLM "Software\Clients\StartMenuInternet\LibreWolf\Capabilities\FileAssociations" ".htm" "LibreWolfHTM" + WriteRegStr HKLM "Software\Clients\StartMenuInternet\LibreWolf\Capabilities\FileAssociations" ".html" "LibreWolfHTM" + WriteRegStr HKLM "Software\Clients\StartMenuInternet\LibreWolf\Capabilities\FileAssociations" ".pdf" "LibreWolfHTM" + WriteRegStr HKLM "Software\Clients\StartMenuInternet\LibreWolf\Capabilities\Startmenu" "StartMenuInternet" "LibreWolf" + WriteRegStr HKLM "Software\Clients\StartMenuInternet\LibreWolf\Capabilities\URLAssociations" "http" "LibreWolfHTM" + WriteRegStr HKLM "Software\Clients\StartMenuInternet\LibreWolf\Capabilities\URLAssociations" "https" "LibreWolfHTM" + + WriteRegStr HKLM "Software\Clients\StartMenuInternet\LibreWolf\DefaultIcon" "" "$INSTDIR\librewolf.exe,0" + WriteRegStr HKLM "Software\Clients\StartMenuInternet\LibreWolf\shell\open\command" "" "$INSTDIR\librewolf.exe" + + WriteRegStr HKLM "Software\RegisteredApplications" "LibreWolf" "Software\Clients\StartMenuInternet\LibreWolf\Capabilities" + + WriteRegStr HKLM "Software\Classes\LibreWolfHTM" "" "LibreWolf Handler" + WriteRegStr HKLM "Software\Classes\LibreWolfHTM" "AppUserModelId" "LibreWolf" + WriteRegStr HKLM "Software\Classes\LibreWolfHTM\Application" "AppUserModelId" "LibreWolf" + WriteRegStr HKLM "Software\Classes\LibreWolfHTM\Application" "ApplicationIcon" "$INSTDIR\librewolf.exe,0" + WriteRegStr HKLM "Software\Classes\LibreWolfHTM\Application" "ApplicationName" "LibreWolf" + WriteRegStr HKLM "Software\Classes\LibreWolfHTM\Application" "ApplicationDescription" "Start the LibreWolf Browser" + WriteRegStr HKLM "Software\Classes\LibreWolfHTM\Application" "ApplicationCompany" "LibreWolf Community" + WriteRegStr HKLM "Software\Classes\LibreWolfHTM\DefaultIcon" "" "$INSTDIR\librewolf.exe,0" + WriteRegStr HKLM "Software\Classes\LibreWolfHTM\shell\open\command" "" "$INSTDIR\librewolf.exe %1" + +SectionEnd + + +# Uninstaller +section "Uninstall" + + # Kill LibreWolf if it is still running + nsProcess::_FindProcess "${EXECUTABLE}" + Pop $R0 + ${If} $R0 = 0 + DetailPrint "${APPNAME} is still running, killing it..." + nsProcess::_KillProcess "${EXECUTABLE}" + Sleep 2000 + ${EndIf} + + # Remove Start Menu launcher + delete "$SMPROGRAMS\${COMPANYNAME}\${APPNAME}.lnk" + delete "$SMPROGRAMS\${COMPANYNAME}\Uninstall.lnk" + # Try to remove the Start Menu folder - this will only happen if it is empty + rmDir "$SMPROGRAMS\${COMPANYNAME}" + + # Remove files + rmDir /r $INSTDIR + + # Remove uninstaller information from the registry + DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" + + # + # Windows default browser integration + # + + DeleteRegKey HKLM "Software\Clients\StartMenuInternet\LibreWolf" + DeleteRegKey HKLM "Software\RegisteredApplications" + DeleteRegKey HKLM "Software\Classes\LibreWolfHTM" + +sectionEnd diff --git a/common b/common new file mode 160000 index 0000000..1e52967 --- /dev/null +++ b/common @@ -0,0 +1 @@ +Subproject commit 1e529672fc81de6c15d584d41efa17880b28fea4 diff --git a/mk.py b/mk.py old mode 100755 new mode 100644 index 46ded3c..38d2ee1 --- a/mk.py +++ b/mk.py @@ -1,215 +1,219 @@ -#!/usr/bin/env python3 - -import os,sys,subprocess,os.path - -# native()/bash()/exec() utility functions -def native(cmd,do_print=True): - sys.stdout.flush() - if do_print: - print(cmd) - sys.stdout.flush() - - retval = os.system(cmd) - if retval != 0: - sys.exit(retval) - -def bash(cmd,do_print=True): - tmp = [] - tmp += ['c:/mozilla-build/msys/bin/bash.exe', '-c', cmd] - sys.stdout.flush() - if do_print: - print(cmd) - sys.stdout.flush() - - retval = subprocess.run(tmp).returncode - if retval != 0: - sys.exit(retval) - -def exec(cmd,do_print=True): - _native = False - if not os.path.isfile('c:/mozilla-build/msys/bin/bash.exe'): - _native = True - if _native: - return native(cmd,do_print) - return bash(cmd,do_print) - -def patch(patchfile): - cmd = "patch -p1 -i {}".format(patchfile) - sys.stdout.flush() - print("\n*** -> {}".format(cmd)) - sys.stdout.flush() - - retval = os.system(cmd) - if retval != 0: - sys.stdout.flush() - print("fatal error: patch '{}' failed".format(patchfile)) - sys.stdout.flush() - sys.exit(retval) - - - -# -# main functions -# - - -def fetch(): - - exec('wget -q -O version https://gitlab.com/librewolf-community/browser/source/-/raw/main/version') - exec('wget -q -O source_release https://gitlab.com/librewolf-community/browser/source/-/raw/main/release') - exec('wget -O librewolf-$(cat version)-$(cat source_release).source.tar.gz https://gitlab.com/librewolf-community/browser/source/-/jobs/artifacts/main/raw/librewolf-$(cat version)-$(cat source_release).source.tar.gz?job=build-job') - - - -def build(): - - exec('rm -rf librewolf-$(cat version)') - exec('tar xf librewolf-$(cat version)-$(cat source_release).source.tar.gz') - - with open('version','r') as file: - version = file.read().rstrip() - os.chdir('librewolf-{}'.format(version)) - - # patches - exec('cp -v ../assets/mozconfig.windows mozconfig') - patch('../assets/package-manifest.patch') - - # perform the build and package - exec('MACH_USE_SYSTEM_PYTHON=1 ./mach build') - exec('MACH_USE_SYSTEM_PYTHON=1 ./mach package') - os.chdir('..') - - - -def artifacts(): - - # Trying to fix issue #146 -> https://gitlab.com/librewolf-community/browser/windows/-/issues/146 - # (keep this False for now) - _with_app_name = False - - with open('version','r') as file1: - version = file1.read().rstrip() - buildzip_filename = 'firefox-{}.en-US.win64.zip'.format(version) - if _with_app_name: - buildzip_filename = 'librewolf-{}.en-US.win64.zip'.format(version) - exec('cp -v librewolf-{}/obj-x86_64-pc-mingw32/dist/{} .'.format(version,buildzip_filename)) - exec('rm -rf work && mkdir work') - os.chdir('work') - exec('unzip ../{}'.format(buildzip_filename)) - if not _with_app_name: - exec('mv firefox librewolf') - os.chdir('librewolf') - if not _with_app_name: - exec('mv firefox.exe librewolf.exe') - os.chdir('..') - os.chdir('..') - - # let's get 'release'. - with open('release','r') as file2: - release = file2.read().rstrip() - if release == '0' : - full_version = '{}'.format(version) - else: - full_version = '{}.{}'.format(version,release) - - # let's copy in the .ico icon. - exec('cp -v assets/librewolf.ico work/librewolf') - - # Let's make the portable zip first. - os.chdir('work') - exec('rm -rf librewolf-{}'.format(version)) - os.makedirs('librewolf-{}/Profiles/Default'.format(version), exist_ok=True) - os.makedirs('librewolf-{}/LibreWolf'.format(version), exist_ok=True) - exec('cp -vr librewolf/* librewolf-{}/LibreWolf'.format(version)) - exec('wget -q -O librewolf-{}/librewolf-portable.exe https://gitlab.com/librewolf-community/browser/windows/uploads/8347381f01806245121adcca11b7f35c/librewolf-portable.exe'.format(version)) - zipname = 'librewolf-{}.en-US.win64.zip'.format(full_version) - exec("rm -f ../{}".format(zipname)) - exec("zip -qr9 ../{} librewolf-{}".format(zipname,version)) - os.chdir('..') - - # With that out of the way, we need to create the nsis setup. - os.chdir('work') - setupname = 'librewolf-{}.en-US.win64-setup.exe'.format(full_version) - exec('sed \"s/pkg_version/{}/g\" < ../assets/setup.nsi > tmp.nsi'.format(full_version)) - exec('makensis-3.01.exe -V1 tmp.nsi') - exec('rm -f tmp.nsi') - exec("mv {} ..".format(setupname)) - os.chdir('..') - - - -# utility function -def do_upload(filename,token): - exec('echo _ >> upload.txt') - exec('curl --request POST --header \"PRIVATE-TOKEN: {}\" --form \"file=@{}\" \"https://gitlab.com/api/v4/projects/13852981/uploads\" >> upload.txt'.format(token,filename),False) - exec('echo _ >> upload.txt') - - -def upload(token): - - with open('version','r') as file1: - version = file1.read().rstrip() - with open('release','r') as file2: - release = file2.read().rstrip() - if release == '0' : - full_version = '{}'.format(version) - else: - full_version = '{}.{}'.format(version,release) - - # Files we need to upload.. - zip_filename = 'librewolf-{}.en-US.win64.zip'.format(full_version) - setup_filename = 'librewolf-{}.en-US.win64-setup.exe'.format(full_version) - exec('sha256sum {} {} > sha256sums.txt'.format(setup_filename,zip_filename)) - exec('rm -f upload.txt') - do_upload(setup_filename,token) - do_upload(zip_filename,token) - do_upload('sha256sums.txt',token) - - -# -# parse commandline for commands -# - -help_msg = ''' -Use: ./mk.py ... - -commands: - fetch - build - artifacts - upload - -''' - -done_something = False - -in_upload=False -for arg in sys.argv: - if in_upload: - upload(arg) - done_something=True - elif arg == 'fetch': - fetch() - done_something = True - elif arg == 'build': - build() - done_something = True - elif arg == 'artifacts': - artifacts() - done_something = True - elif arg == 'upload': - in_upload = True - else: - if arg == sys.argv[0]: - pass - else: - print(help_msg) - sys.exit(1) - - - -if done_something: - sys.exit(0) - -print(help_msg) -sys.exit(1) +#!/usr/bin/env python3 + +import os,sys,subprocess,os.path + +# native()/bash()/exec() utility functions +def native(cmd,do_print=True): + sys.stdout.flush() + if do_print: + print(cmd) + sys.stdout.flush() + + retval = os.system(cmd) + if retval != 0: + sys.exit(retval) + +def bash(cmd,do_print=True): + tmp = [] + tmp += ['c:/mozilla-build/msys/bin/bash.exe', '-c', cmd] + sys.stdout.flush() + if do_print: + print(cmd) + sys.stdout.flush() + + retval = subprocess.run(tmp).returncode + if retval != 0: + sys.exit(retval) + +def exec(cmd,do_print=True): + _native = False + if not os.path.isfile('c:/mozilla-build/msys/bin/bash.exe'): + _native = True + if _native: + return native(cmd,do_print) + return bash(cmd,do_print) + +def patch(patchfile): + cmd = "patch -p1 -i {}".format(patchfile) + sys.stdout.flush() + print("\n*** -> {}".format(cmd)) + sys.stdout.flush() + + retval = os.system(cmd) + if retval != 0: + sys.stdout.flush() + print("fatal error: patch '{}' failed".format(patchfile)) + sys.stdout.flush() + sys.exit(retval) + + + +# +# main functions +# + + +def fetch(): + + exec('wget -q -O version https://gitlab.com/librewolf-community/browser/source/-/raw/main/version') + exec('wget -q -O source_release https://gitlab.com/librewolf-community/browser/source/-/raw/main/release') + exec('wget -O librewolf-$(cat version)-$(cat source_release).source.tar.gz https://gitlab.com/librewolf-community/browser/source/-/jobs/artifacts/main/raw/librewolf-$(cat version)-$(cat source_release).source.tar.gz?job=build-job') + + + +def build(): + + exec('rm -rf librewolf-$(cat version)') + exec('tar xf librewolf-$(cat version)-$(cat source_release).source.tar.gz') + + with open('version','r') as file: + version = file.read().rstrip() + os.chdir('librewolf-{}'.format(version)) + + # patches + exec('cp -v ../assets/mozconfig.windows mozconfig') + patch('../assets/package-manifest.patch') + + # perform the build and package + exec('MACH_USE_SYSTEM_PYTHON=1 ./mach build') + exec('MACH_USE_SYSTEM_PYTHON=1 ./mach package') + os.chdir('..') + + + +def artifacts(): + + # Trying to fix issue #146 -> https://gitlab.com/librewolf-community/browser/windows/-/issues/146 + # (keep this False for now) + _with_app_name = False + + with open('version','r') as file1: + version = file1.read().rstrip() + buildzip_filename = 'firefox-{}.en-US.win64.zip'.format(version) + if _with_app_name: + buildzip_filename = 'librewolf-{}.en-US.win64.zip'.format(version) + exec('cp -v librewolf-{}/obj-x86_64-pc-mingw32/dist/{} .'.format(version,buildzip_filename)) + exec('rm -rf work && mkdir work') + os.chdir('work') + exec('unzip ../{}'.format(buildzip_filename)) + if not _with_app_name: + exec('mv firefox librewolf') + os.chdir('librewolf') + if not _with_app_name: + exec('mv firefox.exe librewolf.exe') + os.chdir('..') + os.chdir('..') + + # let's get 'release'. + with open('release','r') as file2: + release = file2.read().rstrip() + if release == '0' : + full_version = '{}'.format(version) + else: + full_version = '{}.{}'.format(version,release) + + # let's copy in the .ico icon. + exec('cp -v assets/librewolf.ico work/librewolf') + + # Let's make the portable zip first. + os.chdir('work') + exec('rm -rf librewolf-{}'.format(version)) + os.makedirs('librewolf-{}/Profiles/Default'.format(version), exist_ok=True) + os.makedirs('librewolf-{}/LibreWolf'.format(version), exist_ok=True) + exec('cp -vr librewolf/* librewolf-{}/LibreWolf'.format(version)) + exec('wget -q -O librewolf-{}/librewolf-portable.exe https://gitlab.com/librewolf-community/browser/windows/uploads/8347381f01806245121adcca11b7f35c/librewolf-portable.exe'.format(version)) + zipname = 'librewolf-{}.en-US.win64.zip'.format(full_version) + exec("rm -f ../{}".format(zipname)) + exec("zip -qr9 ../{} librewolf-{}".format(zipname,version)) + os.chdir('..') + + # With that out of the way, we need to create the nsis setup. + os.chdir('work') + exec("mkdir x86-ansi") + exec("wget -q -O ./x86-ansi/nsProcess.dll https://shorsh.de/upload/we7v/nsProcess.dll") + setupname = 'librewolf-{}.en-US.win64-setup.exe'.format(full_version) + exec('sed \"s/pkg_version/{}/g\" < ../assets/setup.nsi > tmp.nsi'.format(full_version)) + exec('cp -v ../assets/librewolf.ico .') + exec('cp -v ../assets/banner.bmp .') + exec('makensis-3.01.exe -V1 tmp.nsi') + exec('rm -rf tmp.nsi librewolf.ico banner.bmp x86-ansi') + exec("mv {} ..".format(setupname)) + os.chdir('..') + + + +# utility function +def do_upload(filename,token): + exec('echo _ >> upload.txt') + exec('curl --request POST --header \"PRIVATE-TOKEN: {}\" --form \"file=@{}\" \"https://gitlab.com/api/v4/projects/13852981/uploads\" >> upload.txt'.format(token,filename),False) + exec('echo _ >> upload.txt') + + +def upload(token): + + with open('version','r') as file1: + version = file1.read().rstrip() + with open('release','r') as file2: + release = file2.read().rstrip() + if release == '0' : + full_version = '{}'.format(version) + else: + full_version = '{}.{}'.format(version,release) + + # Files we need to upload.. + zip_filename = 'librewolf-{}.en-US.win64.zip'.format(full_version) + setup_filename = 'librewolf-{}.en-US.win64-setup.exe'.format(full_version) + exec('sha256sum {} {} > sha256sums.txt'.format(setup_filename,zip_filename)) + exec('rm -f upload.txt') + do_upload(setup_filename,token) + do_upload(zip_filename,token) + do_upload('sha256sums.txt',token) + + +# +# parse commandline for commands +# + +help_msg = ''' +Use: ./mk.py ... + +commands: + fetch + build + artifacts + upload + +''' + +done_something = False + +in_upload=False +for arg in sys.argv: + if in_upload: + upload(arg) + done_something=True + elif arg == 'fetch': + fetch() + done_something = True + elif arg == 'build': + build() + done_something = True + elif arg == 'artifacts': + artifacts() + done_something = True + elif arg == 'upload': + in_upload = True + else: + if arg == sys.argv[0]: + pass + else: + print(help_msg) + sys.exit(1) + + + +if done_something: + sys.exit(0) + +print(help_msg) +sys.exit(1) diff --git a/settings b/settings new file mode 160000 index 0000000..9075142 --- /dev/null +++ b/settings @@ -0,0 +1 @@ +Subproject commit 9075142f3a1b52a949e7f2602b212dc24b6a8cf1