diff --git a/.gitignore b/.gitignore index 6199c3a..1e441da 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ /v-hacd-4.1.0-filtered.tar.xz -/v-hacd-4.1.0-filtered.tar.zst diff --git a/cube.obj b/cube.obj deleted file mode 100644 index 3f91d36..0000000 --- a/cube.obj +++ /dev/null @@ -1,18 +0,0 @@ -# Blender v2.83.4 OBJ File: '' -# www.blender.org -o Cube_Cube.001 -v -1.000000 -1.000000 1.000000 -v -1.000000 1.000000 1.000000 -v -1.000000 1.000000 -1.000000 -v -1.000000 -1.000000 -1.000000 -v 1.000000 1.000000 -1.000000 -v 1.000000 -1.000000 -1.000000 -v 1.000000 1.000000 1.000000 -v 1.000000 -1.000000 1.000000 -s off -f 1 2 3 4 -f 4 3 5 6 -f 6 5 7 8 -f 8 7 2 1 -f 4 6 8 1 -f 5 3 2 7 diff --git a/get_source.sh b/get_source.sh index cc2fd8f..3902a3e 100755 --- a/get_source.sh +++ b/get_source.sh @@ -10,7 +10,7 @@ print_help() Usage: $1 VERSION Generate a source archive for v-hacd with questionably-licensed test/sample -meshes removed. The result will be named v-hacd-\${VERSION}-filtered.tar.zst +meshes removed. The result will be named v-hacd-\${VERSION}-filtered.tar.xz and will be written into the current working directory. EOF } @@ -30,7 +30,7 @@ VERSION="${1}" SOURCE0="${FORGEURL}/archive/v${VERSION}/v-hacd-${VERSION}.tar.gz" TARNAME="$(basename "${SOURCE0}")" TARDIR="$(basename "${SOURCE0}" '.tar.gz')" -NEWTAR="${TARDIR}-filtered.tar.zst" +NEWTAR="${TARDIR}-filtered.tar.xz" SAVEDIR="${PWD}" XDIR="$(mktemp -d)" @@ -39,27 +39,13 @@ trap "rm -rvf '${XDIR}'" INT TERM EXIT cd "${XDIR}" curl -L -O "${SOURCE0}" tar -xzvf "${TARNAME}" -MTIME="$(stat -c '%Y' "${TARDIR}")" rm -rvf "${TARDIR}/app/meshes" if [ "$(find . -type f -name '*.obj' | wc -l)" != '0' ] then echo 'ERROR: did not properly remove problematic content' 1>&2 exit 1 fi -# https://www.gnu.org/software/tar/manual/html_section/Reproducibility.html -# We reset all mtimes to that of the top-level extracted directory; since git -# archives don’t have meaningful per-file mtimes, nothing useful is lost. -TZ=UTC LC_ALL=C tar \ - --create --verbose \ - --sort=name \ - --format=posix \ - --numeric-owner --owner=0 --group=0 \ - --mode=go+u,go-w \ - --pax-option='delete=atime,delete=ctime' \ - --clamp-mtime --mtime="@${MTIME}" \ - "${TARDIR}/" | - zstdmt --ultra -22 > "${NEWTAR}" -touch -d @"${MTIME}" "${NEWTAR}" +tar -cv "${TARDIR}/" | xz -9e > "${NEWTAR}" cd "${SAVEDIR}" mv -v "${XDIR}/${NEWTAR}" . diff --git a/sources b/sources index 2fb9dea..fe165e6 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (v-hacd-4.1.0-filtered.tar.zst) = 07ae9fcd3759c2f4038392be78faf2f24f0d03931b0e417f450d066dfe3c792b15dd2e5c929974eb93326d954be564a2dc5e3ace909656625e99421cad4e47e7 +SHA512 (v-hacd-4.1.0-filtered.tar.xz) = 9e85aeac1d3e6d3a973da6764452bd2444ee15fcf313f723e4127adb4c79e72a0f40663aee3de167b93ced8bd34c96ea1e9ec621a2704b0c58af9f31cbbee4aa diff --git a/v-hacd.rpmlintrc b/v-hacd.rpmlintrc deleted file mode 100644 index ec062ee..0000000 --- a/v-hacd.rpmlintrc +++ /dev/null @@ -1,4 +0,0 @@ -# This Source cannot be a URL because we must filter out certain files. -addFilter(r" invalid-url Source[0-9]+: v-hacd-.*-filtered\.tar\.zst") -# Bogus; it is a perfectly fine zstandard file. -addFilter(r" inconsistent-file-extension v-hacd-.*-filtered\.tar\.zst$") diff --git a/v-hacd.spec b/v-hacd.spec index 3016be6..1b8cb13 100644 --- a/v-hacd.spec +++ b/v-hacd.spec @@ -1,14 +1,16 @@ +%bcond_without tests + Name: v-hacd Version: 4.1.0 Release: %autorelease Summary: Decomposes a 3D surface into a set of “near” convex parts +%undefine __cmake_in_source_build + # The entire source is BSD-3-Clause, except: # - app/wavefront.{h,cpp} are MIT License: BSD-3-Clause AND MIT -# We use an OBJ file from mcut, which is LGPL-3.0-only, for testing: Source3 -SourceLicense: %{license} AND LGPL-3.0-only -URL: https://github.com/kmammou/v-hacd +URL: https://github.com/kmammou/%{name} # This has the app/meshes/ directory stripped out. The .obj files therein have # unclear or unspecified licenses, which makes them unsuitable for Fedora. # @@ -16,21 +18,24 @@ URL: https://github.com/kmammou/v-hacd # README.rst as a sanity check. # # Generated with ./get_source.sh %%{version} -Source0: v-hacd-%{version}-filtered.tar.zst +Source0: %{name}-%{version}-filtered.tar.xz # Script to generate Source0; see comments above. Source1: get_source.sh # Man page hand-written for Fedora in groff_man(7) format based on help output # and README.md contents. Source2: TestVHACD.1 -# Very trivial OBJ mesh file from mcut, which is LGPL-3.0-only -Source3: https://github.com/cutdigital/mcut/raw/refs/tags/v1.3.0/tutorials/BasicCmdLineApp/data/cube.obj - -BuildSystem: cmake # https://fedoraproject.org/wiki/Changes/EncourageI686LeafRemoval ExcludeArch: %{ix86} BuildRequires: gcc-c++ +BuildRequires: cmake +# Our choice; the make backend would work just fine. +BuildRequires: ninja-build + +%if %{with tests} +BuildRequires: vtk-data +%endif %global common_description %{expand: The V-HACD library decomposes a 3D surface into a set of “near” convex parts. @@ -66,14 +71,15 @@ Summary: Development files for V-HACD # The MIT-licensed app/wavefront.{h,cpp} do not contribute to this subpackage. License: BSD-3-Clause + BuildArch: noarch # https://docs.fedoraproject.org/en-US/packaging-guidelines/#_packaging_header_only_libraries -Provides: v-hacd-static = %{?epoch:%{epoch}:}%{version}-%{release} +Provides: %{name}-static = %{?epoch:%{epoch}:}%{version}-%{release} %description devel %{common_description} -The v-hacd-devel package contains the header-only library for developing +The %{name}-devel package contains the header-only library for developing applications that use V-HACD. @@ -89,36 +95,45 @@ License: BSD-3-Clause AND MIT %description tools %{common_description} -The v-hacd-tools package contains command-line tools based on the V-HACD +The %{name}-tools package contains command-line tools based on the V-HACD library. Currently, this means TestVHACD; despite the name, this tool has general utility beyond testing. -%conf -p -cd app +%prep +%autosetup -n %{name}-%{version} -%build -p -cd app +%build +%set_build_flags +pushd app >/dev/null +%cmake -GNinja +%cmake_build +popd >/dev/null %install -install -D --preserve-timestamps --mode=0644 \ - --target='%{buildroot}%{_includedir}' 'include/VHACD.h' -install -D --preserve-timestamps --mode=0644 \ - --target='%{buildroot}%{_mandir}/man1' '%{SOURCE2}' - -cd app +pushd app >/dev/null # There are currently no install targets in app/CMakeLists.txt, so # %%cmake_install will not work. We install the executable manually instead. -install -D --preserve-timestamps \ - --target='%{buildroot}%{_bindir}' '%{_vpath_builddir}/TestVHACD' +install -t '%{buildroot}%{_bindir}' -p -D '%{_vpath_builddir}/TestVHACD' +popd >/dev/null + +install -t '%{buildroot}%{_includedir}' -m 0644 -p -D 'include/VHACD.h' + +install -t '%{buildroot}%{_mandir}/man1' -m 0644 -p -D '%{SOURCE2}' +%if %{with tests} %check # Use the example from README.md as a sanity check, but use an arbitrary mesh -# as input since we cannot ship upstream’s sample meshes. -%{buildroot}%{_bindir}/TestVHACD '%{SOURCE3}' -e 0.01 -d 15 -r 10000000 -r 128 +# from vtk as input since we cannot ship upstream’s sample meshes. Decrease the +# max recursion depth from 15 to the default (10) so this doesn’t explode on +# 32-bit ARM in Fedora 36. +%{buildroot}%{_bindir}/TestVHACD \ + %{_datadir}/vtkdata/Testing/Data/Viewpoint/cow.obj \ + -e 0.01 -d 10 -r 10000000 -r 128 +%endif %files devel