Skip to content

Commit 2f1cb4f

Browse files
committed
[#19]:svarga:fix, macOS productbuild empty package by using explicit CPack component
1 parent 84a8ddd commit 2f1cb4f

2 files changed

Lines changed: 29 additions & 4 deletions

File tree

.github/workflows/package.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: Package
33
on:
44
push:
55
tags: ['v*']
6+
branches: ['19-fix-macos-productbuild']
67

78
permissions:
89
contents: write
@@ -63,7 +64,11 @@ jobs:
6364
shell: bash
6465
run: |
6566
ref="${GITHUB_REF_NAME}"
66-
echo "H5CPP_VERSION=${ref#v}" >> "$GITHUB_ENV"
67+
if [[ "$ref" == v* ]]; then
68+
echo "H5CPP_VERSION=${ref#v}" >> "$GITHUB_ENV"
69+
else
70+
echo "H5CPP_VERSION=1.12.99-test" >> "$GITHUB_ENV"
71+
fi
6772
6873
- name: Install LLVM toolchain (Linux)
6974
if: runner.os == 'Linux'
@@ -213,6 +218,15 @@ jobs:
213218
cpack -G "${{ matrix.generators }}" \
214219
-D "CPACK_PACKAGE_FILE_NAME=h5cpp-compiler-${H5CPP_VERSION}-${{ matrix.asset_suffix }}" \
215220
--config CPackConfig.cmake
221+
# macOS guard: productbuild must produce a real payload
222+
if [[ "${{ matrix.generators }}" == "productbuild" ]]; then
223+
pkg="h5cpp-compiler-${H5CPP_VERSION}-${{ matrix.asset_suffix }}.pkg"
224+
size=$(stat -f%z "$pkg" 2>/dev/null || stat -c%s "$pkg" 2>/dev/null)
225+
if (( size < 100000 )); then
226+
echo "macOS package is suspiciously small (${size} bytes) — likely empty" >&2
227+
exit 1
228+
fi
229+
fi
216230
env:
217231
CPACK_DEBIAN_PACKAGE_ARCHITECTURE: ${{ matrix.deb_arch }}
218232
CPACK_RPM_PACKAGE_ARCHITECTURE: ${{ matrix.rpm_arch }}

CMakeLists.txt

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,13 +181,14 @@ endif()
181181

182182
# Install directives
183183
include(GNUInstallDirs)
184-
install(TARGETS h5cpp DESTINATION ${CMAKE_INSTALL_BINDIR})
185-
install(FILES h5cpp.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
184+
install(TARGETS h5cpp DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT runtime)
185+
install(FILES h5cpp.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 COMPONENT runtime)
186186

187187
# CMake helper modules for consumers
188188
install(
189189
DIRECTORY cmake/
190190
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cmake/h5cpp-compiler
191+
COMPONENT runtime
191192
FILES_MATCHING PATTERN "*.cmake"
192193
)
193194

@@ -215,7 +216,11 @@ set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Source code transformation tool for HDF5
215216
set(CPACK_PACKAGE_CONTACT "steven@vargalabs.com")
216217
set(CPACK_PACKAGE_LICENSE "MIT")
217218
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYRIGHT.txt")
218-
set(CPACK_MONOLITHIC_INSTALL 1)
219+
# MONOLITHIC is safe for DEB/RPM, but breaks productbuild on macOS
220+
# (CMake #18201: empty distribution XML when monolithic + productbuild)
221+
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
222+
set(CPACK_MONOLITHIC_INSTALL 1)
223+
endif()
219224

220225
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
221226
set(CPACK_PACKAGING_INSTALL_PREFIX "/usr")
@@ -235,6 +240,12 @@ endif()
235240

236241
include(CPack)
237242

243+
cpack_add_component(runtime
244+
DISPLAY_NAME "h5cpp-compiler"
245+
DESCRIPTION "Source code transformation tool for HDF5 H5CPP library"
246+
REQUIRED
247+
)
248+
238249
option(H5CPP_BUILD_TESTS "Build h5cpp-compiler fixture tests" ON)
239250
if(H5CPP_BUILD_TESTS)
240251
enable_testing()

0 commit comments

Comments
 (0)