Skip to content

Commit

Permalink
Move files to generate windows installer under dist/windows (#1765)
Browse files Browse the repository at this point in the history
  • Loading branch information
ret2libc authored and XVilka committed Nov 17, 2021
1 parent fcddb66 commit d379546
Show file tree
Hide file tree
Showing 8 changed files with 135 additions and 43 deletions.
25 changes: 1 addition & 24 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
24 changes: 5 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -710,7 +696,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
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,5 @@ subprojects/packagecache/
subprojects/sdb/
subprojects/tree-sitter-*/
subprojects/zlib-*/
subprojects/libdemangle/
dist/windows/Output
29 changes: 29 additions & 0 deletions dist/windows/build_windows_installer.ps1
Original file line number Diff line number Diff line change
@@ -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
Binary file added dist/windows/rizin.ico
Binary file not shown.
97 changes: 97 additions & 0 deletions dist/windows/rizin.iss
Original file line number Diff line number Diff line change
@@ -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;
File renamed without changes.
1 change: 1 addition & 0 deletions doc/PACKAGERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d379546

Please sign in to comment.