diff --git a/.github/workflows/fedora-daily.yml b/.github/workflows/fedora-daily.yml new file mode 100644 index 0000000000..1ea2238ba1 --- /dev/null +++ b/.github/workflows/fedora-daily.yml @@ -0,0 +1,30 @@ +name: Fedora Daily Build +permissions: + contents: read +on: + schedule: + - cron: "00 00 * * *" + workflow_dispatch: + +jobs: + trigger-copr-build: + env: + copr_token: ${{ secrets.COPR_TOKEN }} + runs-on: ubuntu-latest + container: quay.io/packit/packit + steps: + - name: setup copr token + run: | + mkdir -p ~/.config + echo "$copr_token" > ~/.config/copr + - name: checkout sources + uses: actions/checkout@v4 + with: + submodules: recursive + fetch-depth: 500 + fetch-tags: true + - name: Setup safe Git directory + run: git config --global --add safe.directory $GITHUB_WORKSPACE + - name: trigger copr build + run: | + packit build in-copr --project freecad diff --git a/.gitignore b/.gitignore index d12651dca5..4e446be00a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ # file types to ignore .* +!/.packit.yaml !/.clang-format !/.clang-tidy !/.git-blame-ignore-revs diff --git a/.packit.yaml b/.packit.yaml new file mode 100644 index 0000000000..523620a77b --- /dev/null +++ b/.packit.yaml @@ -0,0 +1,68 @@ +specfile_path: package/fedora/freecad.spec +files_to_sync: + - .packit.yaml +actions: + post-upstream-clone: + - bash -c 'BUILD_TAG=dev /usr/bin/python3 package/rattler-build/scripts/make_version_file.py freecad_version.txt' + - rm -f freecad-sources.tar.gz + changelog-entry: + - bash -c 'git log --no-merges --pretty="format:- %s (%an)" $(git describe --tags --abbrev=0 )..HEAD -- |sed 's/%/%%/g'' + create-archive: + - git submodule update --init + - bash -c 'git ls-files --recurse-submodules | tar -caf freecad-sources.tar.gz -T-' + - echo -n 'freecad-sources.tar.gz' +downstream_package_name: freecad +additional_packages: + - python3 + +jobs: +- job: copr_build + identifier: pull_request + trigger: pull_request + notifications: + pull_request: + successful_build: True + branch: main + additional_repos: + - copr://bpostle/IfcOpenShell + manual_trigger: true + targets: + fedora-stable: + without_opts: + - debug_info + fedora-development: + without_opts: + - debug_info + +- job: tests + identifier: pull_request + trigger: pull_request + branch: main + manual_trigger: true + targets: + fedora-latest-stable: + without_opts: + - debug_info + fmf_path: package/fedora/tests + +- job: copr_build + identifier: main + trigger: commit + manual_trigger: true + branch: main + additional_repos: + - copr://bpostle/IfcOpenShell + owner: freecad + project: nightly + +- job: copr_build + identifier: release + trigger: release + owner: freecad + project: freecad + additional_repos: + - copr://bpostle/IfcOpenShell + targets: + fedora-all: + without_opts: + - tests diff --git a/CMakePresets.json b/CMakePresets.json index aad6e140bb..283eb95899 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -307,6 +307,144 @@ "value": "OFF" } } - } + }, + { + "name": "rpm", + "description": "Settings like rpm build", + "displayName": "rpm", + "generator": "Ninja", + "binaryDir": "${sourceDir}/build/rpm", + "cacheVariables": { + "CMAKE_INSTALL_DATAROOTDIR": { + "type": "PATH", + "value": "/usr/share" + }, + "CMAKE_C_FLAGS_RELEASE": { + "type": "STRING", + "value": "-DNDEBUG" + }, + "CMAKE_CXX_FLAGS_RELEASE": { + "type": "STRING", + "value": "-DNDEBUG" + }, + "CMAKE_Fortran_FLAGS_RELEASE": { + "type": "STRING", + "value": "-DNDEBUG" + }, + "CMAKE_VERBOSE_MAKEFILE": { + "type": "BOOL", + "value": "ON" + }, + "CMAKE_INSTALL_DO_STRIP": { + "type": "BOOL", + "value": "OFF" + }, + "CMAKE_INSTALL_PREFIX": { + "type": "PATH", + "value": "/usr/lib64/freecad" + }, + "CMAKE_INSTALL_FULL_SBINDIR": { + "type": "PATH", + "value": "/usr/bin" + }, + "CMAKE_INSTALL_SBINDIR": { + "type": "PATH", + "value": "bin" + }, + "INCLUDE_INSTALL_DIR": { + "type": "PATH", + "value": "/usr/include" + }, + "LIB_INSTALL_DIR": { + "type": "PATH", + "value": "/usr/lib64" + }, + "SYSCONF_INSTALL_DIR": { + "type": "PATH", + "value": "/etc" + }, + "SHARE_INSTALL_PREFIX": { + "type": "PATH", + "value": "/usr/share" + }, + "LIB_SUFFIX": { + "type": "STRING", + "value": "64" + }, + "BUILD_SHARED_LIBS": { + "type": "BOOL", + "value": "ON" + }, + "CMAKE_INSTALL_DOCDIR": { + "type": "PATH", + "value": "/usr/share/doc/freecad" + }, + "CMAKE_INSTALL_INCLUDEDIR": { + "type": "PATH", + "value": "/usr/include" + }, + "RESOURCEDIR": { + "type": "PATH", + "value": "/usr/share/freecad" + }, + "FREECAD_USE_EXTERNAL_PIVY": { + "type": "BOOL", + "value": "TRUE" + }, + "FREECAD_USE_EXTERNAL_FMT": { + "type": "BOOL", + "value": "TRUE" + }, + "FREECAD_USE_PCL": { + "type": "BOOL", + "value": "OFF" + }, + "FREECAD_QT_VERSION": { + "type": "STRING", + "value": "6" + }, + "OpenGL_GL_PREFERENCE": { + "type": "STRING", + "value": "GLVND" + }, + "USE_OCC": { + "type": "BOOL", + "value": "TRUE" + }, + "PYCXX_INCLUDE_DIR": { + "type": "PATH", + "value": "/usr/include" + }, + "PYCXX_SOURCE_DIR": { + "type": "PATH", + "value": "/usr/src/CXX" + }, + "ENABLE_DEVELOPER_TESTS": { + "type": "BOOL", + "value": "TRUE" + }, + "FREECAD_USE_EXTERNAL_GTEST": { + "type": "BOOL", + "value": "TRUE" + }, + "ONDSELSOLVER_BUILD_EXE": { + "type": "BOOL", + "value": "TRUE" + }, + "BUILD_GUI": { + "type": "BOOL", + "value": "TRUE" + } + }, + "environment": { + "CC": "gcc", + "CXX": "g++", + "LT_SYS_LIBRARY_PATH": "/usr/lib64:", + "CCACHE_PROGRAM": "/usr/bin/ccache", + "CFLAGS": "-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer", + "CXXFLAGS": "-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer", + "LDFLAGS": "-Wl,--as-needed -Wl,--no-undefined" + } + } ] } diff --git a/package/fedora/freecad.spec b/package/fedora/freecad.spec index cad3acec66..904de5ca6f 100644 --- a/package/fedora/freecad.spec +++ b/package/fedora/freecad.spec @@ -1,109 +1,67 @@ -# This package depends on automagic byte compilation -# https://fedoraproject.org/wiki/Changes/No_more_automagic_Python_bytecompilation_phase_3 -%global py_bytecompile 1 +# Some configuration options for other environments +# rpmbuild --without=bundled_zipios: don't use bundled version of zipios++ +%bcond_without bundled_zipios +# rpmbuild --with=bundled_pycxx: use bundled version of pycxx +%bcond_with bundled_pycxx +# rpmbuild --without=bundled_smesh: don't use bundled version of Salome's Mesh +%bcond_without bundled_smesh +# rpmbuild --without=bundled_gtest: don't use bundled version of gtest and gmock +%bcond_with bundled_gtest + +# rpmbuild --without=tests exclude tests in %%check +%bcond_without tests +# rpmbuild --without=debug_info don't generate package with debug info +%bcond_without debug_info + + +Name: freecad +Epoch: 1 +Version: 1.1.0~dev +Release: 1%{?dist} + +Summary: A general purpose 3D CAD modeler +Group: Applications/Engineering +License: LGPL-2.0-or-later +URL: https://www.freecad.org/ + +Source0: freecad-sources.tar.gz -# Setup python target for shiboken so the right cmake file is imported. -%global py_suffix %(%{__python3} -c "import sysconfig; print(sysconfig.get_config_var('SOABI'))") # Maintainers: keep this list of plugins up to date -# List plugins in %%{_libdir}/%{name}/lib, less '.so' and 'Gui.so', here -%global plugins AssemblyApp AssemblyGui CAMSimulator DraftUtils Fem FreeCAD Import Inspection MatGui Materials Measure Mesh MeshPart Part PartDesignGui Path PathApp PathSimulator Points QtUnitGui ReverseEngineering Robot Sketcher Spreadsheet Start Surface TechDraw Web _PartDesign area flatmesh libDriver libDriverDAT libDriverSTL libDriverUNV libE57Format libMEFISTO2 libOndselSolver libSMDS libSMESH libSMESHDS libStdMeshers libarea-native +# List plugins in %%{_libdir}/%%{name}/lib, less '.so' and 'Gui.so', here +%global plugins AssemblyApp AssemblyGui CAMSimulator DraftUtils Fem FreeCAD Import Inspection MatGui Materials Measure Mesh MeshPart Part PartDesignGui Path PathApp PathSimulator Points QtUnitGui ReverseEngineering Robot Sketcher Spreadsheet Start Surface TechDraw Web _PartDesign area flatmesh libDriver libDriverDAT libDriverSTL libDriverUNV libE57Format libMEFISTO2 libSMDS libSMESH libSMESHDS libStdMeshers libarea-native -# Some configuration options for other environments -# rpmbuild --with=bundled_zipios: use bundled version of zipios++ -%global bundled_zipios %{?_with_bundled_zipios: 1} %{?!_with_bundled_zipios: 1} -# rpmbuild --with=bundled_pycxx: use bundled version of pycxx -%global bundled_pycxx %{?_with_bundled_pycxx: 1} %{?!_with_bundled_pycxx: 0} -# rpmbuild --without=bundled_smesh: don't use bundled version of Salome's Mesh -%global bundled_smesh %{?_without_bundled_smesh: 0} %{?!_without_bundled_smesh: 1} - -# Prevent RPM from doing its magical 'build' directory for now -%global __cmake_in_source_build 0 +%global exported_libs libOndselSolver # See FreeCAD-main/src/3rdParty/salomesmesh/CMakeLists.txt to find this out. %global bundled_smesh_version 7.7.1.0 - -# Some plugins go in the Mod folder instead of lib. Deal with those here: -%global mod_plugins Mod/PartDesign -%define name freecad -%define github_name FreeCAD -%define branch main - -Name: %{name} -Epoch: 1 -Version: 1.1.0 -Release: pre_{{{git_commit_no}}}%{?dist} -Summary: A general purpose 3D CAD modeler -Group: Applications/Engineering - -License: LGPLv2+ -URL: https://www.freecad.org/ -Source0: {{{ git_repo_pack }}} -#add all submodule as source -Source1: {{{ git_pack path=$GIT_ROOT/src/3rdParty/OndselSolver/ dir_name="OndselSolver" }}} -Source2: {{{ git_pack path=$GIT_ROOT/src/3rdParty/GSL/ dir_name="GSL" }}} -Source3: {{{ git_pack path=$GIT_ROOT/src/Mod/AddonManager/ dir_name="AddonManager" }}} - +# See /src/3rdParty/PyCXX/CXX/Version.h to find this out. +%global bundled_pycxx_version 7.1.9 +# See /src/3rdParty/OndselSolver/CMakeLists.txt to find this out. +%global bundled_ondsel_solver_version 1.0.1 # Utilities -BuildRequires: cmake gcc-c++ gettext -BuildRequires: doxygen swig graphviz -BuildRequires: gcc-gfortran -BuildRequires: desktop-file-utils -BuildRequires: git - -BuildRequires: tbb-devel +BuildRequires: cmake gcc-c++ gettext doxygen swig graphviz gcc-gfortran desktop-file-utils tbb-devel ninja-build strace +%if %{with tests} +BuildRequires: xorg-x11-server-Xvfb python3-typing-extensions +%if %{without bundled_gtest} +BuildRequires: gtest-devel gmock-devel +%endif +%endif # Development Libraries -BuildRequires: freeimage-devel -BuildRequires: libXmu-devel -BuildRequires: mesa-libEGL-devel -BuildRequires: mesa-libGLU-devel -BuildRequires: opencascade-devel -BuildRequires: Coin4-devel -BuildRequires: python3-devel -BuildRequires: python3-matplotlib -BuildRequires: python3-pivy -BuildRequires: boost-devel -BuildRequires: eigen3-devel -BuildRequires: qt6-qtsvg-devel -BuildRequires: qt6-qttools-static - -BuildRequires: fmt-devel - -BuildRequires: xerces-c -BuildRequires: xerces-c-devel -BuildRequires: libspnav-devel - -BuildRequires: python3-shiboken6-devel -BuildRequires: python3-pyside6-devel -BuildRequires: pyside6-tools -%if ! %{bundled_smesh} +BuildRequires:boost-devel Coin4-devel eigen3-devel freeimage-devel fmt-devel libglvnd-devel libicu-devel libspnav-devel libXmu-devel med-devel mesa-libEGL-devel mesa-libGLU-devel netgen-mesher-devel netgen-mesher-devel-private opencascade-devel openmpi-devel python3 python3-devel python3-matplotlib python3-pivy python3-pybind11 python3-pyside6-devel python3-shiboken6-devel pyside6-tools qt6-qttools-static qt6-qtsvg-devel vtk-devel xerces-c-devel yaml-cpp-devel +#pcl-devel +%if %{without bundled_smesh} BuildRequires: smesh-devel %endif -BuildRequires: netgen-mesher-devel -BuildRequires: netgen-mesher-devel-private -%if ! %{bundled_zipios} +%if %{without bundled_zipios} BuildRequires: zipios++-devel %endif - -%if ! %{bundled_pycxx} +%if %{without bundled_pycxx} BuildRequires: python3-pycxx-devel %endif -BuildRequires: python3-pybind11 -BuildRequires: libicu-devel -BuildRequires: vtk-devel -BuildRequires: openmpi-devel -BuildRequires: med-devel -BuildRequires: libkdtree++-devel - -BuildRequires: pcl-devel -BuildRequires: python3 -BuildRequires: libglvnd-devel -BuildRequires: yaml-cpp-devel -#BuildRequires: zlib-devel - # For appdata %if 0%{?fedora} BuildRequires: libappstream-glib @@ -115,39 +73,31 @@ Requires: %{name}-data = %{epoch}:%{version}-%{release} # Obsolete old doc package since it's required for functionality. Obsoletes: %{name}-doc < 0.22-1 -Requires: hicolor-icon-theme +Requires: hicolor-icon-theme fmt python3-matplotlib python3-pivy python3-collada python3-pyside6 qt6-assistant python3-typing-extensions python3-defusedxml -Requires: fmt - -Requires: python3-defusedxml -Requires: python3-pivy -Requires: python3-matplotlib -Requires: python3-collada -Requires: python3-pyside6 -Requires: qt6-assistant - - -%if %{bundled_smesh} +%if %{with bundled_smesh} Provides: bundled(smesh) = %{bundled_smesh_version} %endif -%if %{bundled_pycxx} -Provides: bundled(python-pycxx) +%if %{with bundled_pycxx} +Provides: bundled(python-pycxx) = %{bundled_pycxx_version} %endif -Recommends: python3-pysolar +Provides: bundled(libondselsolver) = %{bundled_ondsel_solver_version} + +Recommends: python3-pysolar IfcOpenShell-python3 # plugins and private shared libs in %%{_libdir}/freecad/lib are private; # prevent private capabilities being advertised in Provides/Requires -%define plugin_regexp /^\\\(libFreeCAD.*%(for i in %{plugins}; do echo -n "\\\|$i\\\|$iGui"; done)\\\)\\\(\\\|Gui\\\)\\.so/d -%{?filter_setup: -%filter_provides_in %{_libdir}/%{name}/lib -%filter_from_requires %{plugin_regexp} -%filter_from_provides %{plugin_regexp} -%filter_provides_in %{_libdir}/%{name}/Mod -%filter_requires_in %{_libdir}/%{name}/Mod -%filter_setup -} +%global plugin_exclude %( for i in %{plugins}; do echo -n "\|$i\(Gui\)\?"; done ) +# prevent declaring Requires for internal FreeCAD libraries +%global lib_exclude %( for i in %{exported_libs}; do echo -n "\|$i"; done ) +%global __requires_exclude_from ^%{_libdir}/%{name}/(lib|Mod)/.* +%global __provides_exclude_from ^%{_libdir}/%{name}/Mod/.* +%global __provides_exclude ^(libFreeCAD.*%{plugin_exclude})\.so.* +%global __requires_exclude ^(libFreeCAD.*%{plugin_exclude}%{lib_exclude})\.so.* + + %description FreeCAD is a general purpose Open Source 3D CAD/MCAD/CAx/CAE/PLM modeler, aimed @@ -166,204 +116,211 @@ Requires: %{name} = %{epoch}:%{version}-%{release} %description data Data files for FreeCAD +%package libondselsolver-devel +Summary: Development file for OndselSolver +BuildArch: noarch +Requires: %{name} = %{epoch}:%{version}-%{release} + +%description libondselsolver-devel +Development file for OndselSolver + + +#path that contain main FreeCAD sources for cmake +%global tests_resultdir %{_datadir}/%{name}/tests_result/%{_arch} + +%if %{without debug_info} +%global debug_package %{nil} +%global _enable_debug_packages 0 +%endif %prep -rm -rf %{github_name} -# extract submodule archive and move in correct path -%setup -T -a 1 -c -q -D -n %{github_name}/src/3rdParty/ #OndselSolver -%setup -T -a 2 -c -q -D -n %{github_name}/src/3rdParty/ #GSL -%setup -T -a 3 -c -q -D -n %{github_name}/src/Mod/ #AddonManager - -%setup -T -b 0 -q -D -n %{github_name} - - -# Remove bundled pycxx if we're not using it -%if ! %{bundled_pycxx} -rm -rf src/CXX -%endif - -%if ! %{bundled_zipios} -rm -rf src/zipios++ -#sed -i "s/zipios-config.h/zipios-config.hpp/g" \ -# src/Base/Reader.cpp src/Base/Writer.h -%endif - -# Removed bundled libraries + %setup -T -a 0 -q -c -n FreeCAD-1.0.2 %build -rm -rf build && mkdir build && cd build + # Deal with cmake projects that tend to link excessively. + LDFLAGS='-Wl,--as-needed -Wl,--no-undefined'; export LDFLAGS -# Deal with cmake projects that tend to link excessively. -CXXFLAGS='-Wno-error=cast-function-type'; export CXXFLAGS -LDFLAGS='-Wl,--as-needed -Wl,--no-undefined'; export LDFLAGS +# -DCMAKE_INSTALL_DATADIR=%{_datadir}/%{name} \ +# -DCMAKE_INSTALL_DATAROOTDIR=%{_datadir} \ -%define MEDFILE_INCLUDE_DIRS %{_includedir}/med/ + %cmake \ + -DCMAKE_INSTALL_PREFIX=%{_libdir}/%{name} \ + -DCMAKE_INSTALL_DOCDIR=%{_docdir}/%{name} \ + -DCMAKE_INSTALL_INCLUDEDIR=%{_includedir} \ + -DRESOURCEDIR=%{_datadir}/%{name} \ + -DFREECAD_USE_EXTERNAL_PIVY=TRUE \ + -DFREECAD_USE_EXTERNAL_FMT=TRUE \ + -DFREECAD_USE_PCL:BOOL=OFF \ + -DFREECAD_QT_VERSION:STRING=6 \ + -DOpenGL_GL_PREFERENCE=GLVND \ + -DUSE_OCC=TRUE \ + %if %{without bundled_pycxx} + -DPYCXX_INCLUDE_DIR=$(pkg-config --variable=includedir PyCXX) \ + -DPYCXX_SOURCE_DIR=$(pkg-config --variable=srcdir PyCXX) \ + %endif + %if %{without bundled_smesh} + -DFREECAD_USE_EXTERNAL_SMESH=TRUE \ + %endif + %if %{without bundled_zipios} + -DFREECAD_USE_EXTERNAL_ZIPIOS=TRUE \ + %endif + %if %{with tests} + -DENABLE_DEVELOPER_TESTS=TRUE \ + %if %{without bundled_gtest} + -DFREECAD_USE_EXTERNAL_GTEST=TRUE \ + %else + -DINSTALL_GTEST=OFF \ + -DINSTALL_GMOCK=OFF \ + %endif + %else + -DENABLE_DEVELOPER_TESTS=FALSE \ + %endif + -DONDSELSOLVER_BUILD_EXE=TRUE \ + -DBUILD_GUI=TRUE \ + -G Ninja -%cmake \ - -DCMAKE_INSTALL_PREFIX=%{_libdir}/%{name} \ - -DCMAKE_INSTALL_DATADIR=%{_datadir}/%{name} \ - -DCMAKE_INSTALL_DOCDIR=%{_docdir}/%{name} \ - -DCMAKE_INSTALL_INCLUDEDIR=%{_includedir} \ - -DRESOURCEDIR=%{_datadir}/%{name} \ - -DFREECAD_USE_EXTERNAL_PIVY=TRUE \ - -DFREECAD_USE_EXTERNAL_FMT=TRUE \ - -DFREECAD_USE_PCL:BOOL=OFF \ - -DFREECAD_QT_VERSION:STRING=6 \ - -DSHIBOKEN_INCLUDE_DIR=%{_includedir}/shiboken6 \ - -DSHIBOKEN_LIBRARY=-lshiboken6.%{py_suffix} \ - -DPYTHON_SUFFIX=.%{py_suffix} \ - -DPYSIDE_INCLUDE_DIR=/usr/include/PySide6 \ - -DPYSIDE_LIBRARY=-lpyside6.%{py_suffix} \ - -DPython3_EXECUTABLE:FILEPATH=/usr/bin/python3 \ - -DMEDFILE_INCLUDE_DIRS=%{MEDFILE_INCLUDE_DIRS} \ - -DOpenGL_GL_PREFERENCE=GLVND \ - -DCOIN3D_INCLUDE_DIR=%{_includedir}/Coin4 \ - -DCOIN3D_DOC_PATH=%{_datadir}/Coin4/Coin \ - -DUSE_OCC=TRUE \ -%if ! %{bundled_smesh} - -DFREECAD_USE_EXTERNAL_SMESH=TRUE \ - -DSMESH_FOUND=TRUE \ - -DSMESH_INCLUDE_DIR=%{_includedir}/smesh \ - -DSMESH_DIR=`pwd`/../cMake \ -%endif -%if ! %{bundled_zipios} - -DFREECAD_USE_EXTERNAL_ZIPIOS=TRUE \ -%endif -%if ! %{bundled_pycxx} - -DPYCXX_INCLUDE_DIR=$(pkg-config --variable=includedir PyCXX) \ - -DPYCXX_SOURCE_DIR=$(pkg-config --variable=srcdir PyCXX) \ -%endif - -DPACKAGE_WCREF="%{release} (Git)" \ - -DPACKAGE_WCURL="git://github.com/%{github_name}/FreeCAD.git main" \ - -DENABLE_DEVELOPER_TESTS=FALSE \ - -DBUILD_GUI=TRUE \ - ../ + %cmake_build -make fc_version -for I in src/Build/Version.h src/Build/Version.h.out; do - sed -i 's,FCRevision \"Unknown\",FCRevision \"%{release} (Git)\",' $I - sed -i 's,FCRepositoryURL \"Unknown\",FCRepositoryURL \"git://github.com/FreeCAD/FreeCAD.git main\",' $I -done - -%{make_build} %install -cd build -%make_install + %cmake_install -# Symlink binaries to /usr/bin -mkdir -p %{buildroot}%{_bindir} -ln -s ../%{_lib}/%{name}/bin/FreeCAD %{buildroot}%{_bindir}/FreeCAD -ln -s ../%{_lib}/%{name}/bin/FreeCADCmd %{buildroot}%{_bindir}/FreeCADCmd + # Symlink binaries to /usr/bin + mkdir -p %{buildroot}%{_bindir} + ln -s ../%{_lib}/%{name}/bin/FreeCAD %{buildroot}%{_bindir}/FreeCAD + ln -s ../%{_lib}/%{name}/bin/FreeCADCmd %{buildroot}%{_bindir}/FreeCADCmd -mkdir %{buildroot}%{_metainfodir}/ -mv %{buildroot}%{_libdir}/%{name}/share/metainfo/* %{buildroot}%{_metainfodir}/ + # Remove header from external library that's erroneously installed + rm -rf %{buildroot}%{_libdir}/%{name}/include/E57Format + rm -rf %{buildroot}%{_includedir}/gmock + rm -rf %{buildroot}%{_includedir}/gtest -mkdir %{buildroot}%{_datadir}/applications/ -mv %{buildroot}%{_libdir}/%{name}/share/applications/* %{buildroot}%{_datadir}/applications/ - - -mkdir -p %{buildroot}%{_datadir}/thumbnailers/ -mv %{buildroot}%{_libdir}/%{name}/share/thumbnailers/* %{buildroot}%{_datadir}/thumbnailers/ - -mkdir -p %{buildroot}%{_datadir}/icons/hicolor/scalable/ -mv %{buildroot}%{_libdir}/%{name}/share/icons/hicolor/scalable/* %{buildroot}%{_datadir}/icons/hicolor/scalable/ - -mkdir -p %{buildroot}%{_datadir}/pixmaps/ -mv %{buildroot}%{_libdir}/%{name}/share/pixmaps/* %{buildroot}%{_datadir}/pixmaps/ - -mkdir -p %{buildroot}%{_datadir}/mime/packages/ -mv %{buildroot}%{_libdir}/%{name}/share/mime/packages/* %{buildroot}%{_datadir}/mime/packages/ - -pushd %{buildroot}%{_libdir}/%{name}/share/ -rmdir metainfo/ -rmdir applications/ -rm -rf mime -rm -rf icons -popd - -# Remove obsolete Start_Page.html -rm -f %{buildroot}%{_docdir}/%{name}/Start_Page.html - -# Remove header from external library that's erroneously installed -rm -f %{buildroot}%{_libdir}/%{name}/include/E57Format/E57Export.h - -rm -rf %{buildroot}%{_includedir}/OndselSolver/* -rm -f %{buildroot}%{_libdir}/%{name}/share/pkgconfig/OndselSolver.pc - -# Bug maintainers to keep %%{plugins} macro up to date. -# -# Make sure there are no plugins that need to be added to plugins macro -new_plugins=`ls %{buildroot}%{_libdir}/%{name}/%{_lib} | sed -e '%{plugin_regexp}'` -if [ -n "$new_plugins" ]; then - echo -e "\n\n\n**** ERROR:\n" \ - "\nPlugins not caught by regexp: " $new_plugins \ - "\n\nPlugins in %{_libdir}/%{name}/lib do not exist in" \ - "\nspecfile %%{plugins} macro. Please add these to" \ - "\n%%{plugins} macro at top of specfile and rebuild.\n****\n" 1>&2 - exit 1 -fi -# Make sure there are no entries in the plugins macro that don't match plugins -for p in %{plugins}; do - if [ -z "`ls %{buildroot}%{_libdir}/%{name}/%{_lib}/$p*.so`" ]; then - set +x - echo -e "\n\n\n**** ERROR:\n" \ - "\nExtra entry in %%{plugins} macro with no matching plugin:" \ - "'$p'.\n\nPlease remove from %%{plugins} macro at top of" \ - "\nspecfile and rebuild.\n****\n" 1>&2 - exit 1 - fi -done - -# Bytecompile Python modules -%py_byte_compile %{__python3} %{buildroot}%{_libdir}/%{name} + rm -rf %{buildroot}%{_libdir}/%{name}/%{_lib}/cmake + rm -rf %{buildroot}%{_libdir}/%{name}/%{_lib}/pkgconfig + #Move files using `-DCMAKE_INSTALL_DATAROOTDIR=%%{_datadir}` break ctest + mkdir -p %{buildroot}%{_datadir} + mv %{buildroot}%{_libdir}/freecad/share/applications %{buildroot}%{_datadir}/ + mkdir -p %{buildroot}%{_metainfodir} + mv %{buildroot}%{_libdir}/freecad/share/metainfo/* %{buildroot}%{_metainfodir}/ + mkdir -p %{buildroot}%{_datadir} + mv %{buildroot}%{_libdir}/freecad/share/icons %{buildroot}%{_datadir}/ + mv %{buildroot}%{_libdir}/freecad/share/pixmaps %{buildroot}%{_datadir}/ + mv %{buildroot}%{_libdir}/freecad/share/mime %{buildroot}%{_datadir}/ + mv %{buildroot}%{_libdir}/freecad/share/thumbnailers %{buildroot}%{_datadir}/ + mv %{buildroot}%{_libdir}/freecad/share/pkgconfig %{buildroot}%{_datadir}/ %check -desktop-file-validate \ - %{buildroot}%{_datadir}/applications/org.freecad.FreeCAD.desktop -%{?fedora:appstream-util validate-relax --nonet \ - %{buildroot}%{_metainfodir}/*.metainfo.xml} +%if %{with tests} + mkdir -p %{buildroot}%tests_resultdir + if %ctest -E '^QuantitySpinBox_Tests_run$' &> %{buildroot}%tests_resultdir/ctest.result ; then + echo "ctest OK" + else + echo "**** Failed ctest ****" + touch %{buildroot}%tests_resultdir/ctest.failed + fi + + if xvfb-run \%ctest -R '^QuantitySpinBox_Tests_run$' &>> %{buildroot}%tests_resultdir/ctest_gui.result ; then + echo "ctest gui OK" + else + echo "**** Failed ctest gui ****" + touch %{buildroot}%tests_resultdir/ctest_gui.failed + fi +%endif + + desktop-file-validate %{buildroot}%{_datadir}/applications/org.freecad.FreeCAD.desktop + %{?fedora:appstream-util validate-relax --nonet %{buildroot}%{_metainfodir}/*.metainfo.xml} + + # Bug maintainers to keep %%{plugins} macro up to date. + # + # Make sure there are no plugins that need to be added to plugins macro + %define plugin_regexp /^\\\(libFreeCAD.*%(for i in %{plugins}; do echo -n "\\\|$i"; done)\\\)\\\(\\\|Gui\\\)\\.so/d + %define exported_libs_regexp /^\\\(%(for i in %{exported_libs}; do echo -n "\\\|$i"; done)\\\)\\.so/d + + new_plugins=`ls %{buildroot}%{_libdir}/%{name}/%{_lib} | sed -e '%{plugin_regexp}' -e '%exported_libs_regexp'` + if [ -n "$new_plugins" ]; then + echo -e "\n\n\n**** ERROR:\n" \ + "\nPlugins not caught by regexps:" \ + "\n" $new_plugins \ + "\n\nPlugins in %{_libdir}/%{name}/lib do not exist in" \ + "\nspecfile %%{plugins} or %%{exported_libs_regexp} macro." \ + "\nPlease add these to %%{plugins} or %%{exported_libs}" \ + "\nmacro at top of specfile" \ + "\nand rebuild.\n****\n" 1>&2 + exit 1 + fi + # Make sure there are no entries in the plugins macro that don't match plugins + for p in %{plugins}; do + if [ -z "`ls %{buildroot}%{_libdir}/%{name}/%{_lib}/$p*.so`" ]; then + set +x + echo -e "\n\n\n**** ERROR:\n" \ + "\nExtra entry in %%{plugins} macro with no matching plugin:" \ + "'$p'.\n\nPlease remove from %%{plugins} macro at top of" \ + "\nspecfile and rebuild.\n****\n" 1>&2 + exit 1 + fi + done + # Make sure there are no entries in the exported_libs_regexp macro that don't match plugins + for d in %{exported_libs}; do + if [ -z "`ls %{buildroot}%{_libdir}/%{name}/%{_lib}/$d*.so`" ]; then + set +x + echo -e "\n\n\n**** ERROR:\n" \ + "\nExtra entry in %%{exported_libs} macro with no matching lib:" \ + "'$d'.\n\nPlease remove from %%{exported_libs} macro at top of" \ + "\nspecfile and rebuild.\n****\n" 1>&2 + exit 1 + fi + done + %post -/bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null || : -/usr/bin/update-desktop-database &> /dev/null || : -/usr/bin/update-mime-database %{_datadir}/mime &> /dev/null || : + /bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null || : + /usr/bin/update-desktop-database &> /dev/null || : + /usr/bin/update-mime-database %{_datadir}/mime &> /dev/null || : + %postun -if [ $1 -eq 0 ] ; then - /bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null - /usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : -fi -/usr/bin/update-desktop-database &> /dev/null || : -/usr/bin/update-mime-database %{_datadir}/mime &> /dev/null || : + if [ $1 -eq 0 ] ; then + /bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null + /usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : + fi + /usr/bin/update-desktop-database &> /dev/null || : + /usr/bin/update-mime-database %{_datadir}/mime &> /dev/null || : + %posttrans -/usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor/scalable/apps &>/dev/null || : + /usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor/scalable/apps &>/dev/null || : %files + %{_bindir}/* + %{_metainfodir}/* + %dir %{_libdir}/%{name} + %{_libdir}/%{name}/bin/ + %{_libdir}/%{name}/%{_lib}/ + %{_libdir}/%{name}/Ext/ + %{_libdir}/%{name}/Mod/ + %{_libdir}/%{name}/share/ + %{_datadir}/applications/* + %{_datadir}/icons/hicolor/* + %{_datadir}/pixmaps/* + %{_datadir}/mime/packages/* + %{_datadir}/thumbnailers/* + #find a way to configure in cmake with %%name to avoid conflict with different package name + %{python3_sitelib}/freecad/* +%if %{with tests} + %tests_resultdir/* +%endif -%{_bindir}/* -%{_metainfodir}/* -%dir %{_libdir}/%{name} -%{_libdir}/%{name}/bin/ -%{_libdir}/%{name}/%{_lib}/ -%{_libdir}/%{name}/Ext/ -%{_libdir}/%{name}/Mod/ -%{_datadir}/applications/* -%{_datadir}/icons/hicolor/scalable/* -%{_datadir}/pixmaps/* -%{_datadir}/mime/packages/* -%{_datadir}/thumbnailers/* -%{_libdir}/../lib/python*/site-packages/%{name}/* %files data -%{_datadir}/%{name}/ -%{_docdir}/%{name}/LICENSE.html -%{_docdir}/%{name}/ThirdPartyLibraries.html + %{_datadir}/%{name}/ + %{_docdir}/%{name}/LICENSE.html + %{_docdir}/%{name}/ThirdPartyLibraries.html + +%files libondselsolver-devel + %{_datadir}/pkgconfig/OndselSolver.pc + %{_includedir}/OndselSolver/* %changelog -* Mon Mar 10 2025 Leif-Jöran Olsson - 1.1.0-1 -- Adding support for building with Qt6 and PySide6 for Fedora 40+ diff --git a/package/fedora/rpkg.conf b/package/fedora/rpkg.conf deleted file mode 100644 index 07bc74aa96..0000000000 --- a/package/fedora/rpkg.conf +++ /dev/null @@ -1,3 +0,0 @@ -[rpkg] -auto_pack = False -user_macros = "${git_props:root}/rpkg.macros" diff --git a/package/fedora/tests/.fmf/version b/package/fedora/tests/.fmf/version new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/package/fedora/tests/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/package/fedora/tests/.gitignore b/package/fedora/tests/.gitignore new file mode 100644 index 0000000000..68760df6be --- /dev/null +++ b/package/fedora/tests/.gitignore @@ -0,0 +1 @@ +!/.fmf/ diff --git a/package/fedora/tests/build_time_tests.fmf b/package/fedora/tests/build_time_tests.fmf new file mode 100644 index 0000000000..2811c70378 --- /dev/null +++ b/package/fedora/tests/build_time_tests.fmf @@ -0,0 +1,12 @@ +/ctest : + test: | + cat /usr/share/freecad/tests_result/`uname -m`/ctest.result + if [ -f /usr/share/freecad/tests_result/`uname -m`/ctest.failed ]; then + exit 1 + fi +/ctest_gui : + test: | + cat /usr/share/freecad/tests_result/`uname -m`/ctest_gui.result + if [ -f /usr/share/freecad/tests_result/`uname -m`/ctest_gui.failed ]; then + exit 1 + fi diff --git a/package/fedora/tests/cmd_tests.fmf b/package/fedora/tests/cmd_tests.fmf new file mode 100644 index 0000000000..32326d151b --- /dev/null +++ b/package/fedora/tests/cmd_tests.fmf @@ -0,0 +1,42 @@ +/tests: + /TestAssemblyWorkbench : + test: /usr/bin/FreeCADCmd -t TestAssemblyWorkbench + /TestArch : + test: /usr/bin/FreeCADCmd -t TestArch + /TestCAMApp : + test: /usr/bin/FreeCADCmd -t TestCAMApp + /TestDraft : + test: /usr/bin/FreeCADCmd -t TestDraft + /TestFemApp : + test: /usr/bin/FreeCADCmd -t TestFemApp + /TestMaterialsApp : + test: /usr/bin/FreeCADCmd -t TestMaterialsApp + /MeshTestsApp : + test: /usr/bin/FreeCADCmd -t MeshTestsApp + /TestPartApp : + test: /usr/bin/FreeCADCmd -t TestPartApp + /TestPartDesignApp : + test: /usr/bin/FreeCADCmd -t TestPartDesignApp + /TestSketcherApp : + test: /usr/bin/FreeCADCmd -t TestSketcherApp + /TestSpreadsheet : + test: /usr/bin/FreeCADCmd -t TestSpreadsheet + /TestSurfaceApp : + test: /usr/bin/FreeCADCmd -t TestSurfaceApp + /TestTechDrawApp : + test: /usr/bin/FreeCADCmd -t TestTechDrawApp + /BaseTests : + test: /usr/bin/FreeCADCmd -t BaseTests + /UnitTests : + test: /usr/bin/FreeCADCmd -t UnitTests + /Document : + test: /usr/bin/FreeCADCmd -t Document + /Metadata : + test: /usr/bin/FreeCADCmd -t Metadata + /StringHasher : + test: /usr/bin/FreeCADCmd -t StringHasher + /UnicodeTests : + test: /usr/bin/FreeCADCmd -t UnicodeTests + /TestPythonSyntax : + test: /usr/bin/FreeCADCmd -t TestPythonSyntax + diff --git a/package/fedora/tests/gui_tests.fmf b/package/fedora/tests/gui_tests.fmf new file mode 100644 index 0000000000..44c1d1cfaa --- /dev/null +++ b/package/fedora/tests/gui_tests.fmf @@ -0,0 +1,74 @@ +/tests: + /TestAssemblyWorkbench : + test: xvfb-run /usr/bin/FreeCAD -t TestAssemblyWorkbench + /TestArch : + test: xvfb-run /usr/bin/FreeCAD -t TestArch + /TestCAMApp : + test: xvfb-run /usr/bin/FreeCAD -t TestCAMApp + /TestDraft : + test: xvfb-run /usr/bin/FreeCAD -t TestDraft + /TestFemApp : + test: xvfb-run /usr/bin/FreeCAD -t TestFemApp + /TestMaterialsApp : + test: xvfb-run /usr/bin/FreeCAD -t TestMaterialsApp + /MeshTestsApp : + test: xvfb-run /usr/bin/FreeCAD -t MeshTestsApp + /TestPartApp : + test: xvfb-run /usr/bin/FreeCAD -t TestPartApp + /TestPartDesignApp : + test: xvfb-run /usr/bin/FreeCAD -t TestPartDesignApp + /TestSketcherApp : + test: xvfb-run /usr/bin/FreeCAD -t TestSketcherApp + /TestSpreadsheet : + test: xvfb-run /usr/bin/FreeCAD -t TestSpreadsheet + /TestSurfaceApp : + test: xvfb-run /usr/bin/FreeCAD -t TestSurfaceApp + /TestTechDrawApp : + test: xvfb-run /usr/bin/FreeCAD -t TestTechDrawApp + /BaseTests : + test: xvfb-run /usr/bin/FreeCAD -t BaseTests + /UnitTests : + test: xvfb-run /usr/bin/FreeCAD -t UnitTests + /Document : + test: xvfb-run /usr/bin/FreeCAD -t Document + /Metadata : + test: xvfb-run /usr/bin/FreeCAD -t Metadata + /StringHasher : + test: xvfb-run /usr/bin/FreeCAD -t StringHasher + /UnicodeTests : + test: xvfb-run /usr/bin/FreeCAD -t UnicodeTests + /TestPythonSyntax : + test: xvfb-run /usr/bin/FreeCAD -t TestPythonSyntax + /TestArchGui : + test: xvfb-run /usr/bin/FreeCAD -t TestArchGui + /TestCAMGui : + test: xvfb-run /usr/bin/FreeCAD -t TestCAMGui + /TestDraftGui : + test: xvfb-run /usr/bin/FreeCAD -t TestDraftGui + /TestFemGui : + test: xvfb-run /usr/bin/FreeCAD -t TestFemGui + /TestImportGui : + test: xvfb-run /usr/bin/FreeCAD -t TestImportGui + /TestMaterialsGui : + test: xvfb-run /usr/bin/FreeCAD -t TestMaterialsGui + /TestOpenSCADGui : + test: xvfb-run /usr/bin/FreeCAD -t TestOpenSCADGui + /TestPartGui : + test: xvfb-run /usr/bin/FreeCAD -t TestPartGui + /TestPartDesignGui : + test: xvfb-run /usr/bin/FreeCAD -t TestPartDesignGui + /TestSketcherGui : + test: xvfb-run /usr/bin/FreeCAD -t TestSketcherGui + /TestTechDrawGui : + test: xvfb-run /usr/bin/FreeCAD -t TestTechDrawGui + /Workbench : + test: xvfb-run /usr/bin/FreeCAD -t Workbench + /Menu : + test: xvfb-run /usr/bin/FreeCAD -t Menu + /Menu.MenuDeleteCases : + test: xvfb-run /usr/bin/FreeCAD -t Menu.MenuDeleteCases + /Menu.MenuCreateCases : + test: xvfb-run /usr/bin/FreeCAD -t Menu.MenuCreateCases + /GuiDocument : + test: xvfb-run /usr/bin/FreeCAD -t GuiDocument + diff --git a/package/fedora/tests/plan.fmf b/package/fedora/tests/plan.fmf new file mode 100644 index 0000000000..6cd572686c --- /dev/null +++ b/package/fedora/tests/plan.fmf @@ -0,0 +1,10 @@ +summary: + Run All FreeCAD python tests +prepare: + how: install + package: + - xorg-x11-server-Xvfb +discover: + how: fmf +execute: + how: tmt diff --git a/package/fedora/tests/smoke_test.fmf b/package/fedora/tests/smoke_test.fmf new file mode 100644 index 0000000000..346e9f289f --- /dev/null +++ b/package/fedora/tests/smoke_test.fmf @@ -0,0 +1,4 @@ +summary: Run All FreeCADCmd python tests +test: /usr/bin/FreeCADCmd -v +require: /usr/bin/FreeCADCmd +duration: 1m diff --git a/rpkg.macros b/rpkg.macros deleted file mode 100644 index 13e4c09de7..0000000000 --- a/rpkg.macros +++ /dev/null @@ -1,4 +0,0 @@ -function git_commit_no { - commits=$(curl -s 'https://api.github.com/repos/FreeCAD/FreeCAD/compare/120ca87015...main' | grep "\"ahead_by\":" | sed -s 's/ //g' | sed -s 's/"ahead_by"://' | sed -s 's/,//') - echo -n $((commits + 1)) -}