diff --git a/.github/workflows/build-mac.yml b/.github/workflows/build-mac.yml index 6541ec28..563ada8b 100644 --- a/.github/workflows/build-mac.yml +++ b/.github/workflows/build-mac.yml @@ -91,6 +91,24 @@ jobs: cd iPlug2/Dependencies/IPlug ./download-clap-sdks.sh ${{env.CLAP_VER}} + - name: Install pandoc + uses: pandoc/actions/setup@v1 + + - name: Install typst + uses: typst-community/setup-typst@v5 + + - name: Validate installer docs + shell: bash + run: | + set -eo pipefail + cd ${{matrix.project}} + python3 scripts/prepare_installer_docs.py mac + test -f build-mac/installer/resources/license.rtf + test -f build-mac/installer/resources/readme-mac.rtf + test -f build-mac/installer/resources/intro.rtf + test -f "build-mac/manual/${{matrix.project}} manual.pdf" + test -f "manual/${{matrix.project}} manual.md" + - name: Build shell: bash run: | diff --git a/.github/workflows/build-win.yml b/.github/workflows/build-win.yml index 24f015c2..4670b189 100644 --- a/.github/workflows/build-win.yml +++ b/.github/workflows/build-win.yml @@ -80,6 +80,25 @@ jobs: cd iPlug2/Dependencies/IPlug ./download-clap-sdks.sh ${{env.CLAP_VER}} + - name: Install pandoc + uses: pandoc/actions/setup@v1 + + - name: Install typst + uses: typst-community/setup-typst@v5 + + - name: Validate installer docs + shell: pwsh + run: | + $ErrorActionPreference = 'Stop' + $PSNativeCommandUseErrorActionPreference = $true + cd ${{matrix.project}} + python scripts/prepare_installer_docs.py win + if (!(Test-Path "build-win\installer-docs\license.txt")) { throw "Missing generated license.txt" } + if (!(Test-Path "build-win\installer-docs\readme-win.txt")) { throw "Missing generated readme-win.txt" } + if (!(Test-Path "build-win\installer-docs\readme-win-demo.txt")) { throw "Missing generated readme-win-demo.txt" } + if (!(Test-Path "build-win\manual\${{matrix.project}} manual.pdf")) { throw "Missing generated manual PDF" } + if (!(Test-Path "manual\${{matrix.project}} manual.md")) { throw "Missing Markdown manual" } + - name: Add msbuild to PATH uses: microsoft/setup-msbuild@v2 diff --git a/.github/workflows/release-native.yml b/.github/workflows/release-native.yml index f660f2ba..b039a57d 100644 --- a/.github/workflows/release-native.yml +++ b/.github/workflows/release-native.yml @@ -51,6 +51,12 @@ jobs: with: submodules: recursive + - name: Install pandoc + uses: pandoc/actions/setup@v1 + + - name: Install typst + uses: typst-community/setup-typst@v5 + - name: Get VST3 SDK run: | cd iPlug2/Dependencies/IPlug @@ -68,7 +74,7 @@ jobs: if: matrix.os == 'macOS-latest' run: | ARCHIVE_NAME=`python3 iPlug2/Scripts/get_archive_name.py ${{env.PROJECT_NAME}} mac full` - echo "name=archive_name::$ARCHIVE_NAME" >> $GITHUB_OUTPUT + echo "archive_name=$ARCHIVE_NAME" >> $GITHUB_OUTPUT shell: bash - name: Build macOS @@ -116,7 +122,7 @@ jobs: if: matrix.os == 'windows-latest' run: | ARCHIVE_NAME=`python.exe iPlug2/Scripts/get_archive_name.py ${{env.PROJECT_NAME}} win full` - echo "name=archive_name::$ARCHIVE_NAME" >> $GITHUB_OUTPUT + echo "archive_name=$ARCHIVE_NAME" >> $GITHUB_OUTPUT shell: bash - name: Build Windows diff --git a/TemplateProject/README.md b/TemplateProject/README.md index 35a7e084..56d42966 100644 --- a/TemplateProject/README.md +++ b/TemplateProject/README.md @@ -1,3 +1,7 @@ # TemplateProject readme iPlug2 template project + +## Distribution docs + +Installer text lives in `installer/*.md` and the user manual lives in `manual/TemplateProject manual.md`. The packaging scripts use Pandoc to generate installer-compatible RTF/TXT files and a PDF manual from those Markdown sources during release builds. diff --git a/TemplateProject/installer/TemplateProject.iss b/TemplateProject/installer/TemplateProject.iss index d6e2f6b9..91b8aca0 100644 --- a/TemplateProject/installer/TemplateProject.iss +++ b/TemplateProject/installer/TemplateProject.iss @@ -14,7 +14,7 @@ SolidCompression=yes OutputDir=.\..\build-win\installer ArchitecturesInstallIn64BitMode=x64 OutputBaseFilename=TemplateProject Installer -LicenseFile=license.rtf +LicenseFile=..\build-win\installer-docs\license.txt SetupLogging=yes ShowComponentSizes=no ; WizardImageFile=installer_bg-win.bmp @@ -63,7 +63,7 @@ Source: "..\build-win\TemplateProject.vst3\*.*"; Excludes: "\Contents\x86\*,*.pd Source: "..\build-win\TemplateProject.vst3\Desktop.ini"; DestDir: "{cf64}\VST3\TemplateProject.vst3\"; Check: Is64BitInstallMode; Components:vst3_64; Flags: overwritereadonly ignoreversion; Attribs: hidden system; Source: "..\build-win\TemplateProject.vst3\PlugIn.ico"; DestDir: "{cf64}\VST3\TemplateProject.vst3\"; Check: Is64BitInstallMode; Components:vst3_64; Flags: overwritereadonly ignoreversion; Attribs: hidden system; -Source: "..\build-win\TemplateProject.clap"; DestDir: {commoncf64}\CLAP\; Check: Is64BitInstallMode; Components:clap_64; Flags: ignoreversion; +Source: "..\build-win\TemplateProject_x64.clap"; DestDir: {commoncf64}\CLAP\; Check: Is64BitInstallMode; Components:clap_64; Flags: ignoreversion; ;Source: "..\build-win\aax\bin\TemplateProject.aaxplugin\*.*"; Excludes: "\Contents\x64\*,*.pdb,*.exp,*.lib,*.ilk,*.ico,*.ini"; DestDir: "{cf32}\Avid\Audio\Plug-Ins\TemplateProject.aaxplugin\"; Components:aax_32; Flags: ignoreversion recursesubdirs; ;Source: "..\build-win\aax\bin\TemplateProject.aaxplugin\Desktop.ini"; DestDir: "{cf32}\Avid\Audio\Plug-Ins\TemplateProject.aaxplugin\"; Components:aax_32; Flags: overwritereadonly ignoreversion; Attribs: hidden system; @@ -73,15 +73,15 @@ Source: "..\build-win\TemplateProject.clap"; DestDir: {commoncf64}\CLAP\; Check: ;Source: "..\build-win\TemplateProject.aaxplugin\Desktop.ini"; DestDir: "{cf64}\Avid\Audio\Plug-Ins\TemplateProject.aaxplugin\"; Check: Is64BitInstallMode; Components:aax_64; Flags: overwritereadonly ignoreversion; Attribs: hidden system; ;Source: "..\build-win\TemplateProject.aaxplugin\PlugIn.ico"; DestDir: "{cf64}\Avid\Audio\Plug-Ins\TemplateProject.aaxplugin\"; Check: Is64BitInstallMode; Components:aax_64; Flags: overwritereadonly ignoreversion; Attribs: hidden system; -Source: "..\manual\TemplateProject manual.pdf"; DestDir: "{app}" +Source: "..\build-win\manual\TemplateProject manual.pdf"; DestDir: "{app}" Source: "changelog.txt"; DestDir: "{app}" -Source: "readme-win.rtf"; DestDir: "{app}"; DestName: "readme.rtf"; Flags: isreadme +Source: "..\build-win\installer-docs\readme-win.txt"; DestDir: "{app}"; DestName: "readme.txt"; Flags: isreadme [Icons] Name: "{group}\TemplateProject"; Filename: "{app}\TemplateProject_x64.exe" Name: "{group}\User guide"; Filename: "{app}\TemplateProject manual.pdf" Name: "{group}\Changelog"; Filename: "{app}\changelog.txt" -;Name: "{group}\readme"; Filename: "{app}\readme.rtf" +;Name: "{group}\readme"; Filename: "{app}\readme.txt" Name: "{group}\Uninstall TemplateProject"; Filename: "{app}\unins000.exe" [Code] @@ -142,4 +142,4 @@ begin end; [UninstallDelete] -Type: files; Name: "{app}\InstallationLogFile.log" \ No newline at end of file +Type: files; Name: "{app}\InstallationLogFile.log" diff --git a/TemplateProject/installer/intro.md b/TemplateProject/installer/intro.md new file mode 100644 index 00000000..cfe84313 --- /dev/null +++ b/TemplateProject/installer/intro.md @@ -0,0 +1,7 @@ +# TemplateProject + +Thanks for purchasing TemplateProject. + +support@acmeinc.com + +http://www.acmeinc.com diff --git a/TemplateProject/installer/intro.rtf b/TemplateProject/installer/intro.rtf deleted file mode 100644 index 1372ced0..00000000 --- a/TemplateProject/installer/intro.rtf +++ /dev/null @@ -1,13 +0,0 @@ -{\rtf1\ansi\ansicpg1252\cocoartf1561\cocoasubrtf600 -\cocoascreenfonts1{\fonttbl\f0\fnil\fcharset0 LucidaGrande;} -{\colortbl;\red255\green255\blue255;} -{\*\expandedcolortbl;;} -\paperw11900\paperh16840\margl1440\margr1440\vieww14440\viewh8920\viewkind0 -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\partightenfactor0 - -\f0\fs26 \cf0 Thanks for purchasing TemplateProject\'85 \ -\ -{\field{\*\fldinst{HYPERLINK "mailto::contact@acmeinc.com"}}{\fldrslt contact@acmeinc.com}}\ -\ -{\field{\*\fldinst{HYPERLINK "http://www.acmeinc.com"}}{\fldrslt http://www.acmeinc.com}}\ -} \ No newline at end of file diff --git a/TemplateProject/installer/license.md b/TemplateProject/installer/license.md new file mode 100644 index 00000000..fe9508ee --- /dev/null +++ b/TemplateProject/installer/license.md @@ -0,0 +1,37 @@ +# TemplateProject License + +**THIS IS A PLACEHOLDER LICENCE PROVIDED WITH IPLUG2** + +**IT HAS NO LEGAL BASIS** + +**YOU MAY WISH TO CONSULT A LAWYER BEFORE MAKING A LICENCE** + +## Caveat + +By installing this software you agree to use it at your own risk. The developer cannot be held responsible for any damages caused as a result of its use. + +## Distribution + +You are not permitted to distribute the software without the developer's permission. This includes, but is not limited to, distribution on magazine covers or software review websites. + +## Multiple Installations* + +If you purchased this product as an individual, you are licensed to install and use the software on any computer you need to use it on, providing you remove it afterwards if it is a shared machine. If you purchased it as an institution or company, you are licensed to use it on one machine only, and must purchase additional copies for each machine you wish to use it on. + +## Upgrades* + +If you purchased this product you are entitled to free updates until the next major version number. The developer makes no guarantee that this product will be maintained indefinitely. + +## License transfers* + +If you purchased this product you may transfer your license to another person. As the original owner you are required to contact the developer with the details of the license transfer, so that the new owner can receive the updates and support attached to the license. Upon transferring a license the original owner must remove any copies from their machines and are no longer permitted to use the software. + +TemplateProject is (C) Copyright AcmeInc 2019 + +http://www.acmeinc.com + +VST and VST3 are trademarks of Steinberg Media Technologies GmbH. +Audio Unit is a trademark of Apple, Inc. +AAX is a trademark of Avid, Inc. + +Applies to full version only, not the demo version. diff --git a/TemplateProject/installer/license.rtf b/TemplateProject/installer/license.rtf deleted file mode 100644 index 6a20a306..00000000 --- a/TemplateProject/installer/license.rtf +++ /dev/null @@ -1,45 +0,0 @@ -{\rtf1\ansi\ansicpg1252\cocoartf1561\cocoasubrtf600 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 ArialMT;} -{\colortbl;\red255\green255\blue255;} -{\*\expandedcolortbl;;} -\paperw11900\paperh16840\margl1440\margr1440\vieww17060\viewh12300\viewkind0 -\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0 - -\f0\b\fs20 \cf0 THIS IS A PLACEHOLDER LICENCE PROVIDED WITH IPLUG2 \ -\ -IT HAS NO LEGAL BASIS\ -\ -YOU MAY WISH TO CONSULT A LAWYER BEFORE MAKING A LICENCE\ -\ -Caveat: -\b0 \ -By installing this software you agree to use it at your own risk. The developer cannot be held responsible for any damages caused as a result of it's use.\ -\ - -\b Distribution: -\b0 \ -You are not permitted to distribute the software without the developer's permission. This includes, but is not limited to the distribution on magazine covers or software review websites.\ -\ - -\b Multiple Installations*: -\b0 If you purchased this product as an individual, you are licensed to install and use the software on any computer you need to use it on, providing you remove it afterwards (if it is a shared machine). If you purchased it as an institution or company, you are licensed to use it on one machine only, and must purchase additional copies for each machine you wish to use it on.\ -\ - -\b Upgrades*: -\b0 If you purchased this product you are entitled to free updates until the next major version number. The developer makes no guarantee is made that this product will be maintained indefinitely.\ -\ - -\b License transfers*: -\b0 If you purchased this product you may transfer your license to another person. As the original owner you are required to contact the developer with the details of the license transfer, so that the new owner can receive the updates and support attached to the license. Upon transferring a license the original owner must remove any copies from their machines and are no longer permitted to use the software.\ -\ - -\b TemplateProject is \'a9 Copyright AcmeInc 2019\ - -\b0 \ -http://www.acmeinc.com\ -\ -VST and VST3 are trademarks of Steinberg Media Technologies GmbH. \ -Audio Unit is a trademark of Apple, Inc. \ -AAX is a trademarks of Avid, Inc.\ -\ -* Applies to full version only, not the demo version.} \ No newline at end of file diff --git a/TemplateProject/installer/readme-mac.md b/TemplateProject/installer/readme-mac.md new file mode 100644 index 00000000..82a1335d --- /dev/null +++ b/TemplateProject/installer/readme-mac.md @@ -0,0 +1,9 @@ +# TemplateProject + +The plugins will be installed in your system plugin folders, which will make them available to all user accounts on your computer. The standalone will be installed in the system Applications folder. + +If you do not want to install all components, click **Customize** on the **Installation Type** page. + +If you experience any problems with TemplateProject, please contact us at: + +support@acmeinc.com diff --git a/TemplateProject/installer/readme-mac.rtf b/TemplateProject/installer/readme-mac.rtf deleted file mode 100644 index ca532ebb..00000000 --- a/TemplateProject/installer/readme-mac.rtf +++ /dev/null @@ -1,16 +0,0 @@ -{\rtf1\ansi\ansicpg1252\cocoartf1561\cocoasubrtf600 -\cocoascreenfonts1{\fonttbl\f0\fnil\fcharset0 LucidaGrande;\f1\fnil\fcharset0 Monaco;} -{\colortbl;\red255\green255\blue255;} -{\*\expandedcolortbl;;} -\paperw11900\paperh16840\margl1440\margr1440\vieww14320\viewh8340\viewkind0 -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\partightenfactor0 - -\f0\fs26 \cf0 The plugins will be installed in your system plugin folders which will make them available to all user accounts on your computer. -\f1\fs20 -\f0\fs26 The standalone will be installed in the system Applications folder. \ -\ -If you don't want to install all components, click "Customize" on the "Installation Type" page.\ -\ -If you experience any problems with TemplateProject, please contact us at the following address:\ -\ -{\field{\*\fldinst{HYPERLINK "mailto::support@acmeinc.com"}}{\fldrslt support@acmeinc.com}}} \ No newline at end of file diff --git a/TemplateProject/installer/readme-win-demo.md b/TemplateProject/installer/readme-win-demo.md new file mode 100644 index 00000000..707095cc --- /dev/null +++ b/TemplateProject/installer/readme-win-demo.md @@ -0,0 +1,9 @@ +# TemplateProject Demo + +Thanks for installing TemplateProject Demo. + +The demo version is ready to use, but may include feature limits or periodic reminders. + +If you experience any problems with TemplateProject, please contact us at: + +support@acmeinc.com diff --git a/TemplateProject/installer/readme-win-demo.rtf b/TemplateProject/installer/readme-win-demo.rtf deleted file mode 100644 index f27316c3..00000000 --- a/TemplateProject/installer/readme-win-demo.rtf +++ /dev/null @@ -1,20 +0,0 @@ -{\rtf1\ansi\ansicpg1252\cocoartf1561\cocoasubrtf600 -{\fonttbl\f0\fnil\fcharset0 LucidaGrande-Bold;\f1\fnil\fcharset0 LucidaGrande;} -{\colortbl;\red255\green255\blue255;} -{\*\expandedcolortbl;;} -\paperw11900\paperh16840\vieww12000\viewh15840\viewkind0 -\deftab720 -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardeftab720\partightenfactor0 - -\f0\b\fs26 \cf0 Thanks for installing TemplateProject Demo -\f1\b0 \ -\ -The Demo is limited ...\ -\ -AcmeInc\ -\ -If you experience any problems with TemplateProject, please contact us at the following address:\ -\ -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\partightenfactor0 -{\field{\*\fldinst{HYPERLINK "mailto::support@acmeinc.com"}}{\fldrslt \cf0 support@acmeinc.com}}\ -} \ No newline at end of file diff --git a/TemplateProject/installer/readme-win.md b/TemplateProject/installer/readme-win.md new file mode 100644 index 00000000..70958421 --- /dev/null +++ b/TemplateProject/installer/readme-win.md @@ -0,0 +1,9 @@ +# TemplateProject + +Thanks for installing TemplateProject. + +The plugins and standalone application are ready to use. + +If you experience any problems with TemplateProject, please contact us at: + +support@acmeinc.com diff --git a/TemplateProject/installer/readme-win.rtf b/TemplateProject/installer/readme-win.rtf deleted file mode 100644 index f1ccace1..00000000 --- a/TemplateProject/installer/readme-win.rtf +++ /dev/null @@ -1,20 +0,0 @@ -{\rtf1\ansi\ansicpg1252\cocoartf1561\cocoasubrtf600 -{\fonttbl\f0\fnil\fcharset0 LucidaGrande-Bold;\f1\fnil\fcharset0 LucidaGrande;} -{\colortbl;\red255\green255\blue255;} -{\*\expandedcolortbl;;} -\paperw11900\paperh16840\vieww12000\viewh15840\viewkind0 -\deftab720 -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardeftab720\partightenfactor0 - -\f0\b\fs26 \cf0 Thanks for installing TemplateProject -\f1\b0 \ -\ -BLAH BLAH BLAH\ -\ -AcmeInc\ -\ -If you experience any problems with TemplateProject, please contact us at the following address:\ -\ -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\partightenfactor0 -{\field{\*\fldinst{HYPERLINK "mailto::support@acmeinc.com"}}{\fldrslt \cf0 acmeinc@AcmeInc.com}}\ -} \ No newline at end of file diff --git a/TemplateProject/manual/TemplateProject manual.md b/TemplateProject/manual/TemplateProject manual.md new file mode 100644 index 00000000..0b5437d5 --- /dev/null +++ b/TemplateProject/manual/TemplateProject manual.md @@ -0,0 +1,5 @@ +# TemplateProject Manual + +This is a placeholder manual for TemplateProject. + +Replace this file with product documentation before shipping. diff --git a/TemplateProject/manual/TemplateProject manual.pdf b/TemplateProject/manual/TemplateProject manual.pdf deleted file mode 100644 index 799c4ae5..00000000 Binary files a/TemplateProject/manual/TemplateProject manual.pdf and /dev/null differ diff --git a/TemplateProject/manual/TemplateProject manual.tex b/TemplateProject/manual/TemplateProject manual.tex deleted file mode 100644 index 216ad1a1..00000000 --- a/TemplateProject/manual/TemplateProject manual.tex +++ /dev/null @@ -1,3 +0,0 @@ -\documentclass[a4paper,14pt]{report} -\begin{document} -\end{document} \ No newline at end of file diff --git a/TemplateProject/scripts/makedist-mac.sh b/TemplateProject/scripts/makedist-mac.sh index ab443953..6318f3b4 100755 --- a/TemplateProject/scripts/makedist-mac.sh +++ b/TemplateProject/scripts/makedist-mac.sh @@ -295,7 +295,7 @@ if [ $BUILD_INSTALLER == 1 ]; then else cp installer/changelog.txt build-mac/installer/ cp installer/known-issues.txt build-mac/installer/ - cp "manual/$PLUGIN_NAME manual.pdf" build-mac/installer/ + cp "build-mac/manual/$PLUGIN_NAME manual.pdf" build-mac/installer/ hdiutil create build-mac/$ARCHIVE_NAME.dmg -format UDZO -srcfolder build-mac/installer/ -ov -anyowners -volname $PLUGIN_NAME fi diff --git a/TemplateProject/scripts/makedist-win.bat b/TemplateProject/scripts/makedist-win.bat index 98cbce2e..02c1419d 100644 --- a/TemplateProject/scripts/makedist-win.bat +++ b/TemplateProject/scripts/makedist-win.bat @@ -37,6 +37,11 @@ echo ------------------------------------------------------------------ echo Updating version numbers ... call python prepare_resources-win.py %DEMO% +call python prepare_installer_docs.py win +if %ERRORLEVEL% neq 0 ( + echo ERROR: preparing installer docs failed + exit /B 1 +) call python update_installer-win.py %DEMO% cd ..\ @@ -105,6 +110,10 @@ echo Making Installer ... REM :64-Bit-is "%ProgramFiles(x86)%\Inno Setup 6\iscc" /Q ".\installer\TemplateProject.iss" + if %ERRORLEVEL% neq 0 ( + echo ERROR: installer build failed + exit /B 1 + ) REM goto END-is REM :END-is @@ -139,4 +148,4 @@ exit /B 1 :SUCCESS echo %ZIP_NAME% -exit /B 0 \ No newline at end of file +exit /B 0 diff --git a/TemplateProject/scripts/makeinstaller-mac.sh b/TemplateProject/scripts/makeinstaller-mac.sh index c941b94e..86c68e3b 100755 --- a/TemplateProject/scripts/makeinstaller-mac.sh +++ b/TemplateProject/scripts/makeinstaller-mac.sh @@ -43,62 +43,65 @@ RSRCS="~/Music/${PRODUCT_NAME}/Resources" OUTPUT_BASE_FILENAME="${PRODUCT_NAME} Installer.pkg" TARGET_DIR="./build-mac/installer" -PKG_DIR=${TARGET_DIR}/pkgs +PKG_DIR="${TARGET_DIR}/pkgs" +RESOURCES_DIR="${TARGET_DIR}/resources" -if [[ ! -d ${TARGET_DIR} ]]; then - mkdir ${TARGET_DIR} +if [[ ! -d "${TARGET_DIR}" ]]; then + mkdir "${TARGET_DIR}" fi -if [[ ! -d ${PKG_DIR} ]]; then - mkdir ${PKG_DIR} +if [[ ! -d "${PKG_DIR}" ]]; then + mkdir "${PKG_DIR}" fi +python3 ./scripts/prepare_installer_docs.py mac || exit 1 + build_flavor() { - TMPDIR=${TARGET_DIR}/tmp - flavor=$1 - flavorprod=$2 - ident=$3 - loc=$4 + TMPDIR="${TARGET_DIR}/tmp" + flavor="$1" + flavorprod="$2" + ident="$3" + loc="$4" echo --- BUILDING ${PRODUCT_NAME}_${flavor}.pkg --- - mkdir -p $TMPDIR - cp -R -L $PRODUCTS/$flavorprod $TMPDIR + mkdir -p "${TMPDIR}" + cp -R -L "${PRODUCTS}/${flavorprod}" "${TMPDIR}" - pkgbuild --root $TMPDIR --identifier $ident --version $VERSION --install-location $loc ${PKG_DIR}/${PRODUCT_NAME}_${flavor}.pkg #|| exit 1 + pkgbuild --root "${TMPDIR}" --identifier "${ident}" --version "${VERSION}" --install-location "${loc}" "${PKG_DIR}/${PRODUCT_NAME}_${flavor}.pkg" #|| exit 1 - rm -r $TMPDIR + rm -r "${TMPDIR}" } # try to build VST2 package -if [[ -d $PRODUCTS/$VST2 ]]; then - build_flavor "VST2" $VST2 "com.AcmeInc.vst2.pkg.${PRODUCT_NAME}" "/Library/Audio/Plug-Ins/VST" +if [[ -d "${PRODUCTS}/${VST2}" ]]; then + build_flavor "VST2" "${VST2}" "com.AcmeInc.vst2.pkg.${PRODUCT_NAME}" "/Library/Audio/Plug-Ins/VST" fi # # try to build VST3 package -if [[ -d $PRODUCTS/$VST3 ]]; then - build_flavor "VST3" $VST3 "com.AcmeInc.vst3.pkg.${PRODUCT_NAME}" "/Library/Audio/Plug-Ins/VST3" +if [[ -d "${PRODUCTS}/${VST3}" ]]; then + build_flavor "VST3" "${VST3}" "com.AcmeInc.vst3.pkg.${PRODUCT_NAME}" "/Library/Audio/Plug-Ins/VST3" fi # # try to build AU package -if [[ -d $PRODUCTS/$AU ]]; then - build_flavor "AU" $AU "com.AcmeInc.au.pkg.${PRODUCT_NAME}" "/Library/Audio/Plug-Ins/Components" +if [[ -d "${PRODUCTS}/${AU}" ]]; then + build_flavor "AU" "${AU}" "com.AcmeInc.au.pkg.${PRODUCT_NAME}" "/Library/Audio/Plug-Ins/Components" fi # # try to build AAX package -if [[ -d $PRODUCTS/$AAX ]]; then - build_flavor "AAX" $AAX "com.AcmeInc.aax.pkg.${PRODUCT_NAME}" ""/Library/Application Support/Avid/Audio/Plug-Ins"" +if [[ -d "${PRODUCTS}/${AAX}" ]]; then + build_flavor "AAX" "${AAX}" "com.AcmeInc.aax.pkg.${PRODUCT_NAME}" "/Library/Application Support/Avid/Audio/Plug-Ins" fi # try to build App package -if [[ -d $PRODUCTS/$APP ]]; then - build_flavor "APP" $APP "com.AcmeInc.app.pkg.${PRODUCT_NAME}" "/Applications" +if [[ -d "${PRODUCTS}/${APP}" ]]; then + build_flavor "APP" "${APP}" "com.AcmeInc.app.pkg.${PRODUCT_NAME}" "/Applications" fi # try to build CLAP package -if [[ -d $PRODUCTS/$CLAP ]]; then - build_flavor "CLAP" $CLAP "com.AcmeInc.clap.pkg.${PRODUCT_NAME}" "/Library/Audio/Plug-Ins/CLAP" +if [[ -d "${PRODUCTS}/${CLAP}" ]]; then + build_flavor "CLAP" "${CLAP}" "com.AcmeInc.clap.pkg.${PRODUCT_NAME}" "/Library/Audio/Plug-Ins/CLAP" fi # write build info to resources folder @@ -117,33 +120,33 @@ fi # create distribution.xml -if [[ -d $PRODUCTS/$VST2 ]]; then +if [[ -d "${PRODUCTS}/${VST2}" ]]; then VST2_PKG_REF="" VST2_CHOICE="" VST2_CHOICE_DEF="${PRODUCT_NAME}_VST2.pkg" fi -if [[ -d $PRODUCTS/$VST3 ]]; then +if [[ -d "${PRODUCTS}/${VST3}" ]]; then VST3_PKG_REF="" VST3_CHOICE="" VST3_CHOICE_DEF="${PRODUCT_NAME}_VST3.pkg" fi -if [[ -d $PRODUCTS/$AU ]]; then +if [[ -d "${PRODUCTS}/${AU}" ]]; then AU_PKG_REF="" AU_CHOICE="" AU_CHOICE_DEF="${PRODUCT_NAME}_AU.pkg" fi -if [[ -d $PRODUCTS/$AAX ]]; then +if [[ -d "${PRODUCTS}/${AAX}" ]]; then AAX_PKG_REF="" AAX_CHOICE="" AAX_CHOICE_DEF="${PRODUCT_NAME}_AAX.pkg" fi -if [[ -d $PRODUCTS/$APP ]]; then +if [[ -d "${PRODUCTS}/${APP}" ]]; then APP_PKG_REF="" APP_CHOICE="" APP_CHOICE_DEF="${PRODUCT_NAME}_APP.pkg" fi -if [[ -d $PRODUCTS/$CLAP ]]; then +if [[ -d "${PRODUCTS}/${CLAP}" ]]; then CLAP_PKG_REF="" CLAP_CHOICE="" CLAP_CHOICE_DEF="${PRODUCT_NAME}_CLAP.pkg" @@ -155,7 +158,7 @@ fi # RES_CHOICE_DEF="${PRODUCT_NAME}_RES.pkg" # fi -cat > ${TARGET_DIR}/distribution.xml << XMLEND +cat > "${TARGET_DIR}/distribution.xml" << XMLEND ${PRODUCT_NAME} ${VERSION} @@ -193,7 +196,8 @@ XMLEND # build installation bundle # --resources . -productbuild --distribution ${TARGET_DIR}/distribution.xml --package-path ${PKG_DIR} "${TARGET_DIR}/$OUTPUT_BASE_FILENAME" +productbuild --distribution "${TARGET_DIR}/distribution.xml" --resources "${RESOURCES_DIR}" --package-path "${PKG_DIR}" "${TARGET_DIR}/${OUTPUT_BASE_FILENAME}" -rm ${TARGET_DIR}/distribution.xml -rm -r $PKG_DIR \ No newline at end of file +rm "${TARGET_DIR}/distribution.xml" +rm -r "${PKG_DIR}" +rm -r "${RESOURCES_DIR}" diff --git a/TemplateProject/scripts/makezip-win.py b/TemplateProject/scripts/makezip-win.py index 14943e01..1957359d 100644 --- a/TemplateProject/scripts/makezip-win.py +++ b/TemplateProject/scripts/makezip-win.py @@ -70,7 +70,7 @@ def main(): projectpath + installer, projectpath + "\\installer\\changelog.txt", projectpath + "\\installer\\known-issues.txt", - projectpath + "\\manual\\TemplateProject manual.pdf" + projectpath + "\\build-win\\manual\\TemplateProject manual.pdf" ] for f in files: diff --git a/TemplateProject/scripts/prepare_installer_docs.py b/TemplateProject/scripts/prepare_installer_docs.py new file mode 100644 index 00000000..29a2d084 --- /dev/null +++ b/TemplateProject/scripts/prepare_installer_docs.py @@ -0,0 +1,118 @@ +#!/usr/bin/env python3 + +import argparse +import os +import shutil +import subprocess + + +SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__)) +PROJECT_DIR = os.path.abspath(os.path.join(SCRIPT_DIR, os.pardir)) +INSTALLER_DIR = os.path.join(PROJECT_DIR, "installer") +MANUAL_DIR = os.path.join(PROJECT_DIR, "manual") +PRODUCT_NAME = os.path.basename(PROJECT_DIR) + + +def read_text(path): + with open(path, "r", encoding="utf-8") as input_file: + return input_file.read() + + +def write_text(path, text, newline="\n"): + os.makedirs(os.path.dirname(path), exist_ok=True) + with open(path, "w", encoding="utf-8", newline=newline) as output_file: + output_file.write(text) + + +def require_tool(name): + if shutil.which(name) is None: + raise RuntimeError(name + " is required to prepare installer documents") + + +def run_pandoc(args): + require_tool("pandoc") + subprocess.run(["pandoc"] + args, check=True) + + +def pandoc_convert(source_path, target_path, output_format, extra_args=None): + os.makedirs(os.path.dirname(target_path), exist_ok=True) + run_pandoc([ + "--from", "markdown", + "--to", output_format, + "--output", target_path, + source_path, + ] + (extra_args or [])) + + +def pandoc_plain_text(source_path, target_path, newline="\n"): + temp_path = target_path + ".tmp" + pandoc_convert(source_path, temp_path, "plain", ["--wrap=none"]) + try: + text = read_text(temp_path).strip() + "\n" + write_text(target_path, text, newline=newline) + finally: + if os.path.exists(temp_path): + os.remove(temp_path) + + +def build_manual_pdf(build_dir_name): + require_tool("typst") + source_path = os.path.join(MANUAL_DIR, PRODUCT_NAME + " manual.md") + target_path = os.path.join(PROJECT_DIR, build_dir_name, "manual", PRODUCT_NAME + " manual.pdf") + os.makedirs(os.path.dirname(target_path), exist_ok=True) + run_pandoc([ + "--from", "markdown", + "--output", target_path, + "--pdf-engine=typst", + source_path, + ]) + print("Prepared manual PDF at " + target_path) + + +def build_mac_docs(): + target_dir = os.path.join(PROJECT_DIR, "build-mac", "installer", "resources") + build_manual_pdf("build-mac") + + for name in ("license", "readme-mac", "intro"): + pandoc_convert( + os.path.join(INSTALLER_DIR, name + ".md"), + os.path.join(target_dir, name + ".rtf"), + "rtf", + ["--standalone"], + ) + + background = os.path.join(INSTALLER_DIR, PRODUCT_NAME + "-installer-bg.png") + if os.path.exists(background): + shutil.copy2(background, os.path.join(target_dir, os.path.basename(background))) + + print("Prepared macOS installer documents in " + target_dir) + + +def build_win_docs(): + target_dir = os.path.join(PROJECT_DIR, "build-win", "installer-docs") + build_manual_pdf("build-win") + + for name in ("license", "readme-win", "readme-win-demo"): + pandoc_plain_text( + os.path.join(INSTALLER_DIR, name + ".md"), + os.path.join(target_dir, name + ".txt"), + newline="\r\n", + ) + + print("Prepared Windows installer documents in " + target_dir) + + +def main(): + parser = argparse.ArgumentParser(description="Prepare installer-compatible documents from Markdown sources.") + parser.add_argument("platform", choices=("mac", "win", "all"), help="Target installer platform.") + args = parser.parse_args() + + if args.platform in ("mac", "all"): + build_mac_docs() + + if args.platform in ("win", "all"): + build_win_docs() + + +if __name__ == "__main__": + main() diff --git a/TemplateProject/scripts/update_installer-win.py b/TemplateProject/scripts/update_installer-win.py index d81fd881..6bad1d19 100644 --- a/TemplateProject/scripts/update_installer-win.py +++ b/TemplateProject/scripts/update_installer-win.py @@ -2,7 +2,7 @@ # this script will update the version and text in the innosetup installer files, based on config.h and demo 1/0 -import plistlib, os, datetime, fileinput, glob, sys, string +import plistlib, os, datetime, fileinput, glob, sys, string, re scriptpath = os.path.dirname(os.path.realpath(__file__)) projectpath = os.path.abspath(os.path.join(scriptpath, os.pardir)) @@ -12,6 +12,16 @@ from parse_config import parse_config +README_SOURCE_RE = re.compile(r'^\s*Source:\s*"', re.IGNORECASE) +README_DEST_RE = re.compile(r'\bDestName:\s*"readme\.txt"', re.IGNORECASE) + +def is_readme_entry(line): + return README_SOURCE_RE.search(line) and README_DEST_RE.search(line) + +def readme_entry(demo): + readme = "readme-win-demo.txt" if demo else "readme-win.txt" + return f'Source: "..\\build-win\\installer-docs\\{readme}"; DestDir: "{{app}}"; DestName: "readme.txt"; Flags: isreadme\n' + def replacestrs(filename, s, r): files = glob.glob(filename) @@ -43,11 +53,8 @@ def main(): else: line="OutputBaseFilename=TemplateProject Installer\n" - if 'Source: "readme' in line: - if demo: - line='Source: "readme-win-demo.rtf"; DestDir: "{app}"; DestName: "readme.rtf"; Flags: isreadme\n' - else: - line='Source: "readme-win.rtf"; DestDir: "{app}"; DestName: "readme.rtf"; Flags: isreadme\n' + if is_readme_entry(line): + line=readme_entry(demo) if "WelcomeLabel1" in line: if demo: