diff --git a/assets/librewolf.ico b/assets/librewolf.ico new file mode 100644 index 0000000..30a72f1 Binary files /dev/null and b/assets/librewolf.ico differ diff --git a/assets/setup.nsi b/assets/setup.nsi new file mode 100644 index 0000000..36ac22f --- /dev/null +++ b/assets/setup.nsi @@ -0,0 +1,124 @@ +# +# 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\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" "Howling to Freedom" + WriteRegStr HKLM "Software\Classes\LibreWolfHTM\Application" "ApplicationCompany" "LibreWolf" + 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 diff --git a/mk.py b/mk.py index 9177027..86c74cf 100755 --- a/mk.py +++ b/mk.py @@ -86,14 +86,51 @@ def build(): def artifacts(): - bash('# guide - you gotta figure this out from the previous ./build.py') + print('[debug] # guide - you gotta figure this out from the previous ./build.py') pass - with open('version','r') as file: - version = file.read().rstrip() - exec('cp -v librewolf-{}/obj-x86_64-pc-mingw32/dist/firefox-{}.en-US.win64.zip .'.format(version,version)) + with open('version','r') as file1: + version = file1.read().rstrip() + buildzip_filename = 'firefox-{}.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)) + exec('mv firefox librewolf') + os.chdir('librewolf') + exec('mv firefox.exe librewolf.exe') + os.chdir('..') + os.chdir('..') - print('mk.py:artifacts(): done.') + # let's get 'release'. + with open('release','r') as file2: + release = file2.read().rstrip() + full_version = '{}.{}'.format(version,release) + print('[debug] mk.py: artifacts(): Building for ful version: {}'.format(full_version)) + + # 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('..') # # parse commandline for commands