diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 8420190a44..a43e794057 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -145,32 +145,45 @@ jobs: BUNDLE_DIR="build/release/bundle" mkdir -p "${BUNDLE_DIR}" - # Copy the entire pixi/conda environment + echo "Copying pixi environment..." cp -a .pixi/envs/default/* "${BUNDLE_DIR}/" + echo "Original size: $(du -sh ${BUNDLE_DIR} | cut -f1)" - # Remove unnecessary files to reduce size + # Remove unnecessary files to reduce size significantly + echo "Removing unnecessary files..." rm -rf "${BUNDLE_DIR}/include" rm -rf "${BUNDLE_DIR}/conda-meta" rm -rf "${BUNDLE_DIR}/doc" + rm -rf "${BUNDLE_DIR}/man" + rm -rf "${BUNDLE_DIR}/share/doc" + rm -rf "${BUNDLE_DIR}/share/man" rm -rf "${BUNDLE_DIR}/share/gtk-doc" + rm -rf "${BUNDLE_DIR}/share/info" rm -rf "${BUNDLE_DIR}/lib/cmake" - find "${BUNDLE_DIR}" -name "*.a" -delete - find "${BUNDLE_DIR}" -name "*.h" -delete - find "${BUNDLE_DIR}" -name "*.cmake" -delete - find "${BUNDLE_DIR}" -path "*/__pycache__/*" -delete - find "${BUNDLE_DIR}" -name "*.pyc" -delete + rm -rf "${BUNDLE_DIR}/lib/pkgconfig" + rm -rf "${BUNDLE_DIR}/share/pkgconfig" + + # Remove static libraries and dev files + find "${BUNDLE_DIR}" -name "*.a" -delete 2>/dev/null || true + find "${BUNDLE_DIR}" -name "*.la" -delete 2>/dev/null || true + find "${BUNDLE_DIR}" -name "*.h" -type f -delete 2>/dev/null || true + find "${BUNDLE_DIR}" -name "*.hpp" -type f -delete 2>/dev/null || true + find "${BUNDLE_DIR}" -name "*.cmake" -delete 2>/dev/null || true + find "${BUNDLE_DIR}" -path "*/__pycache__/*" -delete 2>/dev/null || true + find "${BUNDLE_DIR}" -name "*.pyc" -delete 2>/dev/null || true + find "${BUNDLE_DIR}" -name "*.pyo" -delete 2>/dev/null || true # Keep only necessary binaries if [ -d "${BUNDLE_DIR}/bin" ]; then mv "${BUNDLE_DIR}/bin" "${BUNDLE_DIR}/bin_tmp" mkdir "${BUNDLE_DIR}/bin" - for bin in FreeCAD FreeCADCmd freecad freecadcmd python python3 ccx gmsh dot pip; do - [ -f "${BUNDLE_DIR}/bin_tmp/${bin}" ] && cp "${BUNDLE_DIR}/bin_tmp/${bin}" "${BUNDLE_DIR}/bin/" || true + for bin in FreeCAD FreeCADCmd freecad freecadcmd python python3 python3.11 ccx gmsh dot pip pyside6-rcc; do + [ -f "${BUNDLE_DIR}/bin_tmp/${bin}" ] && cp -a "${BUNDLE_DIR}/bin_tmp/${bin}" "${BUNDLE_DIR}/bin/" || true done rm -rf "${BUNDLE_DIR}/bin_tmp" fi - echo "Bundle size: $(du -sh ${BUNDLE_DIR} | cut -f1)" + echo "Final bundle size: $(du -sh ${BUNDLE_DIR} | cut -f1)" - name: Build .deb package shell: bash diff --git a/package/debian/build-deb.sh b/package/debian/build-deb.sh index 9abff691f0..1c6a452fdd 100755 --- a/package/debian/build-deb.sh +++ b/package/debian/build-deb.sh @@ -329,9 +329,11 @@ chmod 755 "${STAGING_DIR}/DEBIAN/postrm" # Build the .deb package # --root-owner-group ensures all files are owned by root:root (standard practice) +# -Zxz with -z1 uses fast compression (large packages can take very long with default settings) mkdir -p "${OUTPUT_DIR}" -echo "Building package..." -dpkg-deb --build --root-owner-group "${STAGING_DIR}" "${OUTPUT_DIR}/${DEB_NAME}.deb" +echo "Building package (this may take a few minutes for large packages)..." +echo "Staging directory size: $(du -sh "${STAGING_DIR}" | cut -f1)" +dpkg-deb -Zxz -z1 --build --root-owner-group "${STAGING_DIR}" "${OUTPUT_DIR}/${DEB_NAME}.deb" # Verify the package echo "Verifying package..."