Coder Social home page Coder Social logo

beslyric-for-x / beslyric-for-x_windows_deploy-package Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 4.0 50 KB

Deploy and package BesLyric-for-X on Windows.

License: MIT License

PowerShell 22.37% Pascal 63.07% Inno Setup 14.56%
inno-setup powershell enigma-virtual-box windows pascal cqtdeployer mingw mingw-w64 windeployqt

beslyric-for-x_windows_deploy-package's Introduction

BesLyric-for-X Deployment and Packaging Scripts (Windows)

Introduction

The script(s) in this repository are used to deploy and package BesLyric-for-X on Windows.

Environment

Windows 10 x86

Dependent tools

These tools are required to complete the work:

  • PowerShell 5 / 7
  • windeployqt
  • Inno Setup 6.0.5 (u)
  • Enigma Virtual Box v9.60 Build 20210209

How to use

Get

PS > git clone --recurse-submodules https://github.com/BesLyric-for-X/BesLyric-for-X_Windows_deploy-package.git
PS > #         \--------__--------/
PS > #              Important!

Prepare

First of all, we should not let go of any mistake:

$ErrorActionPreference = 'Stop'  # set -e for cmdlet
Set-StrictMode -Version 3.0      # set -u

Then, I think creating some variables may be helpful. For example:

# From qmake
${target}      = '<"TARGET" in qmake project. "BesLyric-for-X" by default>'
${installRoot} = '<"INSTALL_ROOT" of "make install">'

# Common
${deployDirPath} = '<path to the directory contains deployed files>'

# For windeployqt
${windeployqtPath} = '<path to windeployqt.exe>'
${mingwBinDirPath} = '<path to the directory contains g++.exe>'
${libDirPath}      = '<path to "%B4X_DEP_PATH%\lib", contains all 3rd party dll files>'

# For Inno Setup
${isccPath}             = "<path to Inno Setup's ISCC.exe>"
${issCompression}       = '<https://jrsoftware.org/ishelp/topic_setup_compression.htm>'
${issInstallerFilePath} = '<path to generated Inno Setup installer>'

# For Enigma Virtual Box
${enigmavbconsolePath}  = "<path to Enigma Virtual Box's enigmavbconsole.exe>"
${doesEvbCompressFiles} = "does Enigma Virtual Box compress files: $true or $false"
${evbBoxFilePath}       = '<path to generated Enigma Virtual Box boxed exe>'

Execute with parameters

Deployment script

windeployqt
$windeployqtParams = @{
    WINDEPLOYQT_PATH   = ${windeployqtPath}
    MINGW_BIN_DIR_PATH = ${mingwBinDirPath}
    LIB_DIR_PATH       = ${libDirPath}
    TARGET             = ${target}
    INSTALL_ROOT       = ${installRoot}

    DEPLOY_DIR_PATH    = ${deployDirPath}
}

& '.\deploy\call_windeployqt.ps1' @windeployqtParams

Packaging scripts

Inno Setup
$issParams = @{
    ISCC_PATH               = ${isccPath}
    ISS_COMPRESSION         = ${issCompression}
    TARGET                  = ${target}
    DEPLOY_DIR_PATH         = ${deployDirPath}

    ISS_INSTALLER_FILE_PATH = ${issInstallerFilePath}
}

& '.\package\call_iscc.ps1' @issParams
Enigma Virtual Box
$evbParams = @{
    ENIGMAVBCONSOLE_PATH    = ${enigmavbconsolePath}
    DOES_EVB_COMPRESS_FILES = ${doesEvbCompressFiles}
    TARGET                  = ${target}
    DEPLOY_DIR_PATH         = ${deployDirPath}

    EVB_BOX_FILE_PATH       = ${evbBoxFilePath}
}

& '.\package\call_evbconsole.ps1' @evbParams

Common code snippets

Hash Table & Splatting

I'm using hash tables and splatting to reduce the line length of the code.

Hash table:

Splatting:

$hashTable = @{
    foo = 'bar'
}

Invoke-Cmdlet @hashTable

Show all incoming parameters

Source: about_Automatic_Variables - PowerShell | Microsoft Docs § $PSBoundParameters

$PSBoundParameters | Format-List

Execute programs with call operator (&) and check the exit code $LASTEXITCODE

Call operator:

Execution status $? and exit code $LASTEXITCODE :

& '.\foo' 'bar'

if ($LASTEXITCODE -ne 0) {
    throw '...'
}

Get temperary file with specific extension

Source: Temporary file with given extension. | IT Pro PowerShell experience

${tempFile} = `
    [System.IO.Path]::GetTempFileName() | `
    Rename-Item -NewName { $_ -replace @('\.tmp$', '.ext') } -PassThru

Get the absolute path to a file that may not exist

Source: answer 16964490 § How to normalize a path in PowerShell? - Stack Overflow

${absolutePath} = `
    [System.IO.Path]::Combine('baseDirPath', 'relativeOrAbsolutePath')

Doc: Combine(String, String) § Path.Combine Method (System.IO) | Microsoft Docs

Credits

Projects:

Documentation:

beslyric-for-x_windows_deploy-package's People

Contributors

pzhlkj6612 avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

beslyric-for-x_windows_deploy-package's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.