diff --git a/.appveyor.yml b/.appveyor.yml index 0f6ff222c0..b701fdc629 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -105,32 +105,9 @@ for: - rz-test -o results.json -L db - cd .. - after_test: - - git clone --depth 1 https://github.com/rizinorg/rizin-win-installer - - set PATH=%PATH%;%INNO_SETUP% - - iscc rizin-win-installer/rizin.iss /DRizinLocation=..\%DIST_FOLDER%\* /DIcoLocation=rizin.ico /DMyAppVersion=%RZ_VERSION% - - move rizin-win-installer\Output\rizin.exe rizin_installer-%builder%.exe - # Artifacts artifacts: # Binaries - path: "%ARTIFACT_ZIP%" - # Inno Setup files - - path: rizin_installer-%builder%.exe # Test results - - path: test/results.json - -# Upload builds to the CI release at GitHub -# deploy: -# tag: Continuous-Windows -# release: Continuous-Windows -# description: 'Rizin Windows release' -# provider: GitHub -# auth_token: -# secure: aIhLJhegEu8fMuyfhVxiEyF5+28ozTtmDmQ3UBddNou3nQlXyIWJ5dZSPnf6HqsS # encrypted token from GitHub -# artifact: /.*\.zip/ # All generated ZIP packages for MSVC and clang-cl builds -# draft: false -# prerelease: true -# force_update: true -# on: -# branch: master # release from master branch only + - path: test/results.json \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 15fb667f5c..d12279be0f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -521,31 +521,17 @@ jobs: shell: pwsh run: echo "##[set-output name=branch;]$( python sys\\version.py )" id: extract_version - - name: Build with meson + ninja + - name: Build and create zip/installer shell: pwsh - run: | - .github\vsdevenv.ps1 ${{ matrix.bits }} - meson --buildtype=release --prefix=$PWD\rizin-install build ${{ matrix.meson_options }} - ninja -C build - ninja -C build install - - name: Create zip artifact - shell: pwsh - run: 7z a rizin-${{ matrix.name }}-${{ steps.extract_version.outputs.branch }}.zip $PWD\rizin-install + run: .\dist\windows\build_windows_installer.ps1 ${{ matrix.name }} ${{ matrix.bits }} ${{ matrix.meson_options }} - uses: actions/upload-artifact@v2 with: name: rizin-${{ matrix.name }}-${{ steps.extract_version.outputs.branch }}.zip - path: .\rizin-${{ matrix.name }}-${{ steps.extract_version.outputs.branch }}.zip - - uses: actions/checkout@v2 - with: - repository: rizinorg/rizin-win-installer - path: ./rizin-win-installer - - name: Create installer - shell: pwsh - run: iscc rizin-win-installer\rizin.iss /DRizinLocation=..\rizin-install\* /DIcoLocation=rizin.ico /DMyAppVersion=${{ steps.extract_version.outputs.branch }} + path: .\dist\windows\Output\rizin-${{ matrix.name }}-${{ steps.extract_version.outputs.branch }}.zip - uses: actions/upload-artifact@v2 with: name: rizin_installer-${{ matrix.name }}-${{ steps.extract_version.outputs.branch }} - path: rizin-win-installer\Output\rizin.exe + path: .\dist\windows\Output\rizin.exe build-android: name: Build Android ${{ matrix.name }} package @@ -736,7 +722,7 @@ jobs: - name: Check that libraries can be used shell: pwsh run: | - .github\vsdevenv.ps1 ${{ matrix.bits }} + .\dist\windows\vsdevenv.ps1 ${{ matrix.bits }} $env:PATH = "$env:PATH;C:$env:HOMEPATH\AppData\Local\Programs\rizin\bin" $env:PKG_CONFIG_PATH = "C:$env:HOMEPATH\AppData\Local\Programs\rizin\lib\pkgconfig" $env:PKG_CONFIG_PATH diff --git a/.gitignore b/.gitignore index 5a1beeae51..fa9dd75c88 100644 --- a/.gitignore +++ b/.gitignore @@ -138,3 +138,4 @@ subprojects/sdb/ subprojects/tree-sitter-*/ subprojects/zlib-*/ subprojects/libdemangle/ +dist/windows/Output diff --git a/dist/windows/build_windows_installer.ps1 b/dist/windows/build_windows_installer.ps1 new file mode 100644 index 0000000000..38e681bc04 --- /dev/null +++ b/dist/windows/build_windows_installer.ps1 @@ -0,0 +1,29 @@ +$name=$args[0] +$bits=$args[1] +$end=$args.Length +$meson_options=$args[2..$end] +$scriptpath=$PSScriptRoot +$builddir=$(Join-Path -Path $env:TEMP -ChildPath "build-win-installer") +$installdir=$(Join-Path -Path $env:TEMP -ChildPath "rizin-win-installer") + +pushd $PSScriptRoot\..\.. + +$version=$(python sys\version.py) +echo $version + +$env:Path += ";$env:ProgramFiles (x86)\Microsoft Visual Studio\Installer" +$env:Path += ";$env:ProgramFiles\7-Zip" +$env:Path += ";$env:ProgramFiles (x86)\Inno Setup 6" + +dist\windows\vsdevenv.ps1 $bits + +meson --buildtype=release --prefix=$installdir $builddir $meson_options +ninja -C $builddir +ninja -C $builddir install +7z a dist\windows\Output\rizin-$name-$version.zip $installdir +iscc dist\windows\rizin.iss /DRizinLocation=$installdir\* /DLicenseLocation=$PWD\COPYING.LESSER /DMyAppVersion=$version + +rm -r $builddir +rm -r $installdir + +popd \ No newline at end of file diff --git a/dist/windows/rizin.ico b/dist/windows/rizin.ico new file mode 100644 index 0000000000..f33b70e91a Binary files /dev/null and b/dist/windows/rizin.ico differ diff --git a/dist/windows/rizin.iss b/dist/windows/rizin.iss new file mode 100644 index 0000000000..5210406842 --- /dev/null +++ b/dist/windows/rizin.iss @@ -0,0 +1,97 @@ +; Script generated by the Inno Setup Script Wizard. +; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! + +#define MyAppName "Rizin" +#define MyAppPublisher "RizinOrg" +#define MyAppURL "https://rizin.re/" +#define MyAppExeName "bin\rizin.exe" +#define IcoLocation "rizin.ico" + +[Setup] +; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications. +; (To generate a new GUID, click Tools | Generate GUID inside the IDE.) +AppId={{CB991F68-90D9-4DE5-92F4-0F9DC81E6C1F} +AppName={#MyAppName} +AppVersion={#MyAppVersion} +;AppVerName={#MyAppName} {#MyAppVersion} +AppPublisher={#MyAppPublisher} +AppPublisherURL={#MyAppURL} +AppSupportURL={#MyAppURL} +AppUpdatesURL={#MyAppURL} +ArchitecturesInstallIn64BitMode=x64 +DefaultDirName={autopf}\{#MyAppName} +DisableProgramGroupPage=yes +; Remove the following line to run in administrative install mode (install for all users.) +PrivilegesRequired=lowest +PrivilegesRequiredOverridesAllowed=dialog +OutputBaseFilename=rizin +SetupIconFile={#IcoLocation} +LicenseFile={#LicenseLocation} +Compression=lzma +SolidCompression=yes +WizardStyle=modern + +[Languages] +Name: "english"; MessagesFile: "compiler:Default.isl" +Name: "brazilianportuguese"; MessagesFile: "compiler:Languages\BrazilianPortuguese.isl" +Name: "catalan"; MessagesFile: "compiler:Languages\Catalan.isl" +Name: "corsican"; MessagesFile: "compiler:Languages\Corsican.isl" +Name: "czech"; MessagesFile: "compiler:Languages\Czech.isl" +Name: "danish"; MessagesFile: "compiler:Languages\Danish.isl" +Name: "dutch"; MessagesFile: "compiler:Languages\Dutch.isl" +Name: "finnish"; MessagesFile: "compiler:Languages\Finnish.isl" +Name: "french"; MessagesFile: "compiler:Languages\French.isl" +Name: "german"; MessagesFile: "compiler:Languages\German.isl" +Name: "hebrew"; MessagesFile: "compiler:Languages\Hebrew.isl" +Name: "italian"; MessagesFile: "compiler:Languages\Italian.isl" +Name: "japanese"; MessagesFile: "compiler:Languages\Japanese.isl" +Name: "norwegian"; MessagesFile: "compiler:Languages\Norwegian.isl" +Name: "polish"; MessagesFile: "compiler:Languages\Polish.isl" +Name: "portuguese"; MessagesFile: "compiler:Languages\Portuguese.isl" +Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl" +Name: "slovenian"; MessagesFile: "compiler:Languages\Slovenian.isl" +Name: "spanish"; MessagesFile: "compiler:Languages\Spanish.isl" +Name: "turkish"; MessagesFile: "compiler:Languages\Turkish.isl" +Name: "ukrainian"; MessagesFile: "compiler:Languages\Ukrainian.isl" + +[Tasks] +Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked + +[Files] +Source: {#RizinLocation}; DestDir: "{app}"; Flags: recursesubdirs createallsubdirs +Source: "rizin.ico"; DestDir: "{app}"; Flags: ignoreversion +; NOTE: Don't use "Flags: ignoreversion" on any shared system files + +[Registry] +Root: HKCU; Subkey: "Environment"; ValueType: string; ValueName: "Path"; ValueData: "{reg:HKCU\Environment,Path};{app}\bin"; Check: NeedsAddPath(ExpandConstant('{app}\bin')); +Root: HKCU; SubKey: "SOFTWARE\Classes\*\shell\rizin"; ValueType: string; ValueData: "Open in Rizin"; Flags: uninsdeletekey; +Root: HKCU; SubKey: "SOFTWARE\Classes\*\shell\rizin\command"; ValueType: string; ValueData: "{app}\bin\rizin.exe %1"; Flags: uninsdeletekey; +Root: HKCU; SubKey: "SOFTWARE\Classes\*\shell\rizind"; ValueType: string; ValueData: "Open in Rizin debugger"; Flags: uninsdeletekey; +Root: HKCU; SubKey: "SOFTWARE\Classes\*\shell\rizind\command"; ValueType: string; ValueData: "{app}\bin\rizin.exe -d %1"; Flags: uninsdeletekey; + +[Icons] +Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Parameters: "--"; IconFilename: "{autopf}\{#MyAppName}\rizin.ico" +Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Parameters: "--"; IconFilename: "{autopf}\{#MyAppName}\rizin.ico"; Tasks: desktopicon + +[Run] +Filename: "{app}\{#MyAppExeName}"; Parameters: "--"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent + +[Code] +function NeedsAddPath(Param: string): boolean; +var + OrigPath: string; +begin + if not RegQueryStringValue( + HKEY_CURRENT_USER, + 'Environment', + 'Path', OrigPath) + then begin + Result := True; + exit; + end; + { look for the path with leading and trailing semicolon } + { Pos() returns 0 if not found } + Result := + (Pos(';' + UpperCase(Param) + ';', ';' + UpperCase(OrigPath) + ';') = 0) and + (Pos(';' + UpperCase(Param) + '\;', ';' + UpperCase(OrigPath) + ';') = 0); +end; diff --git a/.github/vsdevenv.ps1 b/dist/windows/vsdevenv.ps1 similarity index 100% rename from .github/vsdevenv.ps1 rename to dist/windows/vsdevenv.ps1 diff --git a/doc/PACKAGERS.md b/doc/PACKAGERS.md index cce42613f2..28d0bb4959 100644 --- a/doc/PACKAGERS.md +++ b/doc/PACKAGERS.md @@ -142,6 +142,7 @@ Existing packages ----------------- OSX: execute `dist/osx/build_osx_package.sh` on a MacOS system to create a .pkg installer in the base directory, named `rizin-${VERSION}.pkg`. +Windows installer: execute `dist/windows/build_windows_installer.ps1` Powershell script on a Windows system to create a .exe installer in `dist/windows/Output`, named `rizin.exe`. [BUILDING.md]: https://github.com/rizinorg/rizin/blob/dev/BUILDING.md