HISE Logo Forum
    • Categories
    • Register
    • Login

    Whitebox Package Script Update?

    Scheduled Pinned Locked Moved Solved General Questions
    4 Posts 3 Posters 122 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • HISEnbergH
      HISEnberg
      last edited by

      Hey @d-healey

      I am just familiarizing myself with your game changer video on the script for exporting the plugin and packaging/codesign/notarize/staple the product.

      I just noticed that it uses atool for the codesigning, are you still running this? I've always had to use notarytool and was wondering if you have an updated script for it?

      Also I don't see a license for this, is it free to use or do you have it as GPL? :)

      Fantastic work on this by the way I can't thank you enough.

      d.healeyD clevername27C 2 Replies Last reply Reply Quote 0
      • d.healeyD
        d.healey @HISEnberg
        last edited by d.healey

        @HISEnberg Yeah that video's old now. I'm using the notarytool these days, I'll make an updated video at some point, but here's the script I'm using - lots of stuff in it probably isn't relevant to you.

        #!/bin/bash
        
        project_name="Rhapsody"
        script_dir="$(dirname "${BASH_SOURCE[0]}")"
        project_dir=$script_dir/$project_name
        hise_source=$script_dir/HISE
        hise_path=$hise_source"/projects/standalone/Builds/MacOSX/build/Debug/HISE Debug.app/Contents/MacOS/HISE Debug"
        projucer_path=$hise_source"/tools/projucer/Projucer.app/Contents/MacOS/Projucer"
        
        # Codesigning and notarization credentials
        team_id="" # In the format - My Name (ID number)
        team_id_for_notarization="" # Just the ID number, no parenthesis for this one
        apple_id=""
        app_specific_password=""
        whitebox_packages="/usr/local/bin/packagesbuild"
        bundle_id='com.'${project_name// /}'.pkg'
        
        # Download HISE
        cd $script_dir
        rm -R -f HISE
        git clone https://github.com/davidhealey/HISE.git
        cd $hise_source
        git checkout development
        
        # Extract SDKs
        unzip $script_dir/HISE/tools/SDK/sdk.zip -d $script_dir/HISE/tools/SDK
        
        # Build HISE
        $projucer_path --resave $script_dir/HISE/projects/standalone/HISE\ Standalone.jucer
        cd $script_dir/HISE/projects/standalone/Builds/MacOSX
        xcodebuild -project "HISE Standalone.xcodeproj" -configuration Release -jobs 2 | xcpretty
        
        # Download Rhapsody
        cd $script_dir
        rm -R -f Rhapsody
        git clone --recurse-submodules https://codeberg.org/LibreWave/Rhapsody.git
        
        # Build Rhapsody
        version=$(grep "<Version" "$project_dir/project_info.xml" | cut -d'"' -f2)
        output=$script_dir/output
        
        # Create output directory
        rm -R -f $output
        mkdir $output
        
        # Create and enter binaries dir
        mkdir -p "$project_dir/Binaries"
        cd "$project_dir/Binaries" || exit
        
        # Build the binaries
        "$hise_path" set_hise_folder -p:"$hise_source"
        "$hise_path" set_project_folder -p:"$project_dir"
        
        chmod +x "$projucer_path"
        
        echo Building the standalone app
        "$hise_path" export_ci "XmlPresetBackups/$project_name.xml" -t:standalone -p:""
        chmod +x ./batchCompileOSX
        sh ./batchCompileOSX
        cp -R "./Compiled/$project_name.app" "$output/$project_name.app"
        
        "$hise_path" export_ci "XmlPresetBackups/$project_name.xml" -t:instrument -p:VST_AU
        chmod +x "./batchCompileOSX"
        sh "./batchCompileOSX"
        cp -R "./Builds/MacOSX/build/Release/$project_name.vst3" "$output/$project_name.vst3"
        cp -R "./Builds/MacOSX/build/Release/$project_name.component" "$output/$project_name.component"
        
        echo "Codesigning Standalone"
        codesign --remove-signature "$output/$project_name.app"
        codesign --deep --force --options runtime --sign "Developer ID Application: $team_id" "$output/$project_name.app"
        
        echo "Codesigning Plugin"
        codesign --remove-signature "$output/$project_name.vst3"
        codesign --remove-signature "$output/$project_name.component"
        codesign -s "Developer ID Application: $team_id" "$output/$project_name.vst3" --timestamp
        codesign -s "Developer ID Application: $team_id" "$output/$project_name.component" --timestamp
        
        echo "Build Installer"
        
        cp "$script_dir/License.txt" "$output/License.txt" 
        cp "$script_dir/template.pkgproj" "$output/$project_name.pkgproj"  
        file="$output/$project_name.pkgproj" 
        
        sed -i '' "s/%COMPANY_NAME_NO_SPACES%/$(echo "$company_name" | sed 's/ //g' | tr '[:upper:]' '[:lower:]')/g" $file
        sed -i '' "s/%VERSION%/$version/g" $file
        sed -i '' "s/%COMPANY_NAME%/$company_name/g" $file
        sed -i '' "s/%PROJECT_NAME%/$project_name/g" $file
        sed -i '' "s/%PROJECT_NAME_NO_SPACES%/$(echo "$project_name" | sed 's/ //g')/g" $file
        
        cd "$output"
        $whitebox_packages $file
        
        productsign --sign "Developer ID Installer: $team_id" "$output/build/$project_name.pkg" "$output/$project_name Installer $version.pkg"
        
        echo "Cleanup"
        rm -rf "$script_dir/build"
        
        echo "Notarizing"
        
        response=$(xcrun notarytool submit --apple-id "$apple_id" --password "$app_specific_password" --team-id "$team_id_for_notarization" "$output/$project_name Installer $version.pkg" --wait);
        
        # Get notarization ID
        job_id_line=$(grep -m 1 '  id:' < <(echo -e "${response}"))
        job_id=$(echo "${job_id_line}" | cut -d ":" -s -f 2 | cut -d " " -f 2)
        
        # Get the notarization status from the response
        status_line=$(grep -m 1 '  status:' < <(echo -e "${response}"))
        status_result=$(echo "${status_line}" | cut -d ":" -s -f 2 | cut -d " " -f 2)
        
        echo "${response}"
        
        if [[ ${status_result} != "Accepted" ]]; then
          exit 1
        fi
        
        # Staple the notarization result
        echo "Adding notarization to $project_name Installer $version.pkg"
        success=$(xcrun stapler staple "$output/$project_name Installer $version.pkg")
        if [[ -z "${success}" ]]; then
          echo "[ERROR] Could not staple notarization to app"
          exit 1
        fi
        
        # Confirm stapling
        echo "Checking notarization to $project_name Installer $version.pkg "
        spctl --assess -vvv --type install "$output/$project_name Installer $version.pkg"
        

        @HISEnberg said in Whitebox Package Script Update?:

        Also I don't see a license for this, is it free to use or do you have it as GPL? :)

        You don't need a license for the notarytool, it's included with xcode.

        Libre Wave - Freedom respecting instruments and effects
        My Patreon - HISE tutorials
        YouTube Channel - Public HISE tutorials

        HISEnbergH 1 Reply Last reply Reply Quote 3
        • clevername27C
          clevername27 @HISEnberg
          last edited by

          @HISEnberg (See the post I just made.)

          1 Reply Last reply Reply Quote 0
          • HISEnbergH
            HISEnberg @d.healey
            last edited by

            @d-healey Thank you very much for sharing this, you are too kind.

            1 Reply Last reply Reply Quote 1
            • HISEnbergH HISEnberg has marked this topic as solved on
            • First post
              Last post

            55

            Online

            1.7k

            Users

            11.7k

            Topics

            102.1k

            Posts