Skip to content

Commit e236109

Browse files
committed
Improve code signing and notarization workflow
- Fix CMake syntax error in Packaging.cmake (NOT instead of not) - Use CMake variables with environment fallbacks for all signing credentials - Fix CPACK_PACKAGE_FILE_NAME mismatch by saving to RETUNER_PACKAGE_FILE_NAME - Simplify target dependencies to ensure correct build order - Remove redundant HARDENED_RUNTIME settings from CMakeLists.txt - Add utils/apple.env.sample with example environment variables
1 parent 84b47ae commit e236109

File tree

6 files changed

+52
-16
lines changed

6 files changed

+52
-16
lines changed

.github/copilot-instructions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ When working with this codebase, be aware of these critical audio development co
3535
- CMake-based build that generates platform-specific project files
3636
- Cross-platform considerations for Windows, macOS, and Linux
3737
- Bundle packaging via Python scripts (`utils/artifacts.py`)
38+
- Make sure to `cd` in to the build directory when using the cmake option `--build .`
3839

3940
## Key Components
40-
- **docs/retuner-mockup-00.png**: UI Mockup Design
4141
- **processor.cpp/.hpp**: Audio DSP code and parameter handling
4242
- **editor.cpp/.hpp**: GUI implementation
43+
- **src/app/*.***: Standalon application code
4344
- **CMakeLists.txt**: Build configuration
44-
- **artifacts.py**: Build artifact packaging script
4545

4646
## Performance Considerations
4747
- Audio processing must be efficient and avoid allocations

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
*.exe
66
.DS_Store
77
/utils/codesign.env
8+
/utils/apple.env

CMakeLists.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,6 @@ juce_add_plugin(reTuner
7070
LV2URI "https://kushview.net/plugins/retuner"
7171
VST3_CATEGORIES Fx "Pitch Shift"
7272
AU_MAIN_TYPE "kAudioUnitType_Effect"
73-
74-
HARDENED_RUNTIME_ENABLED TRUE
75-
HARDENED_RUNTIME_OPTIONS
76-
"com.apple.security.cs.allow-jit"
77-
"com.apple.security.cs.disable-library-validation"
78-
"com.apple.security.device.audio-input"
7973
)
8074
clap_juce_extensions_plugin(TARGET reTuner
8175
CLAP_ID "net.kushview.plugins.reTuner"

cmake/CodeSign.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
if(APPLE)
22
# Code signing identity - check CMake variable, then environment, default to ad-hoc
3-
if(NOT DEFINED CODE_SIGN_IDENTITY)
3+
if(NOT CODE_SIGN_IDENTITY)
44
if(DEFINED ENV{CODE_SIGN_IDENTITY})
55
set(CODE_SIGN_IDENTITY "$ENV{CODE_SIGN_IDENTITY}")
66
else()

cmake/Packaging.cmake

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ endif()
3535

3636
set(RETUNER_GENERATOR ${CPACK_GENERATOR})
3737
set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${CPACK_PACKAGE_VERSION}-${RETUNER_SYSTEM_NAME}-${RETUNER_PROCESSOR}")
38+
set(RETUNER_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}")
3839
include(CPack)
3940

4041
add_custom_target(installer
@@ -45,6 +46,10 @@ add_custom_target(installer
4546
VERBATIM
4647
USES_TERMINAL)
4748

49+
if(APPLE)
50+
add_dependencies(installer sign-products)
51+
endif()
52+
4853
if("productbuild" IN_LIST RETUNER_GENERATOR OR RETUNER_GENERATOR STREQUAL "productbuild")
4954
cpack_add_component(AU
5055
DISPLAY_NAME "Audio Unit Plugin"
@@ -70,26 +75,43 @@ endif()
7075

7176
# Signing and notarization targets for macOS
7277
if(APPLE)
73-
set(NOTARIZE_FILE "${PROJECT_BINARY_DIR}/${CPACK_PACKAGE_FILE_NAME}.pkg")
74-
set(UNSIGNED_PKG "${PROJECT_BINARY_DIR}/${CPACK_PACKAGE_FILE_NAME}-unsigned.pkg")
78+
set(NOTARIZE_FILE "${PROJECT_BINARY_DIR}/${RETUNER_PACKAGE_FILE_NAME}.pkg")
79+
set(UNSIGNED_PKG "${PROJECT_BINARY_DIR}/${RETUNER_PACKAGE_FILE_NAME}-unsigned.pkg")
80+
81+
if(NOT INSTALLER_SIGN_IDENTITY)
82+
set(INSTALLER_SIGN_IDENTITY $ENV{INSTALLER_SIGN_IDENTITY})
83+
endif()
84+
85+
if(NOT APPLE_ID)
86+
set(APPLE_ID $ENV{APPLE_ID})
87+
endif()
88+
89+
if(NOT TEAM_ID)
90+
set(TEAM_ID $ENV{TEAM_ID})
91+
endif()
92+
93+
if(NOT APP_PASSWORD)
94+
set(APP_PASSWORD $ENV{APP_PASSWORD})
95+
endif()
7596

7697
# Sign the installer package (uses productsign)
7798
add_custom_target(sign-installer
7899
COMMAND echo "Signing installer package..."
79100
COMMAND ${CMAKE_COMMAND} -E rename "${NOTARIZE_FILE}" "${UNSIGNED_PKG}"
80-
COMMAND productsign --sign "$ENV{INSTALLER_SIGN_IDENTITY}" "${UNSIGNED_PKG}" "${NOTARIZE_FILE}"
101+
COMMAND productsign --sign "${INSTALLER_SIGN_IDENTITY}" "${UNSIGNED_PKG}" "${NOTARIZE_FILE}"
81102
COMMAND ${CMAKE_COMMAND} -E rm -f "${UNSIGNED_PKG}"
82103
COMMAND echo "✓ Signed: ${NOTARIZE_FILE}"
83104
COMMENT "Signing productbuild package with productsign"
84105
VERBATIM
85106
USES_TERMINAL)
107+
add_dependencies(sign-installer installer)
86108

87109
add_custom_target(notarize
88110
COMMAND echo "Submitting for notarization: ${NOTARIZE_FILE}"
89111
COMMAND xcrun notarytool submit "${NOTARIZE_FILE}"
90-
--apple-id "$ENV{APPLE_ID}"
91-
--team-id "$ENV{TEAM_ID}"
92-
--password "$ENV{APP_PASSWORD}"
112+
--apple-id "${APPLE_ID}"
113+
--team-id "${TEAM_ID}"
114+
--password "${APP_PASSWORD}"
93115
--wait
94116
COMMAND echo "Stapling notarization ticket..."
95117
COMMAND xcrun stapler staple "${NOTARIZE_FILE}"
@@ -98,6 +120,5 @@ if(APPLE)
98120
VERBATIM
99121
USES_TERMINAL)
100122

101-
add_dependencies(notarize sign-products installer)
102123
add_dependencies(notarize sign-installer)
103124
endif()

utils/apple.env.sample

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Apple Code Signing and Notarization Environment Variables
2+
# Source this file before building: source apple.env
3+
4+
# Code signing identity for products (AU, VST3, CLAP, LV2, Standalone)
5+
# Example: "Developer ID Application: Your Name (TEAM_ID)"
6+
export CODE_SIGN_IDENTITY="Developer ID Application: Your Company Name (ABCD123456)"
7+
8+
# Installer signing identity for the .pkg
9+
# Example: "Developer ID Installer: Your Name (TEAM_ID)"
10+
export INSTALLER_SIGN_IDENTITY="Developer ID Installer: Your Company Name (ABCD123456)"
11+
12+
# Apple ID for notarization
13+
export APPLE_ID="[email protected]"
14+
15+
# Team ID from Apple Developer account
16+
export TEAM_ID="ABCD123456"
17+
18+
# App-specific password for notarization
19+
# Generate at: https://appleid.apple.com/account/manage (Sign-In and Security > App-Specific Passwords)
20+
export APP_PASSWORD="xxxx-xxxx-xxxx-xxxx"

0 commit comments

Comments
 (0)