Blob Blame Raw
%undefine _ld_as_needed

Name:    antimony
Summary: Computer-aided design CAD tool
Version: 0.9.3
Release: 17%{?dist}
License: MIT
URL:     http://www.mattkeeter.com/projects/antimony/3/
Source0: https://github.com/mkeeter/antimony/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz

##Set compiler flags
Patch0: %{name}-set_flags.patch

##Fix compiling error with Python37
Patch1: %{name}-python3.patch

## Main building
BuildRequires: qt5-qtbase-devel
BuildRequires: desktop-file-utils
BuildRequires: boost-python3-devel
BuildRequires: python3-devel
BuildRequires: lemon
BuildRequires: flex
BuildRequires: libpng-devel
BuildRequires: zlib-devel
BuildRequires: cmake
BuildRequires: gcc, gcc-c++

%if 0%{?fedora}
BuildRequires: libappstream-glib
%endif

%description
Antimony is a computer-aided design (CAD) tool from a
parallel universe in which CAD software evolved
from Lisp machines rather than drafting tables.

Antimony provides the Python3 Fab that is
a set of software tools for personal fabrication,
intended for use with machines common to fab labs.
For info about Fab visit kokompe.cba.mit.edu/.

%prep
%autosetup -n %{name}-%{version} -p0

# Extract the LICENSE
grep "## License" -A 25 README.md | tail -n 25 > LICENSE

sed -e 's|@@optflags@@|%{optflags} -DNDEBUG|g' -i CMakeLists.txt

# Set install directory prefix
sed -e 's|/usr/local|/usr|g' -i app/CMakeLists.txt

%build
mkdir build && cd build
%cmake \
 -DCMAKE_PREFIX_PATH:PATH=%{_prefix} \
 -DCMAKE_INSTALL_PREFIX:PATH=%{_prefix} \
 -DCMAKE_CXX_FLAGS_RELEASE:STRING="%{optflags} -fPIC -pie -DNDEBUG" \
 -DCMAKE_C_FLAGS_RELEASE:STRING="%{optflags} -fPIC -pie -DNDEBUG" \
 -DCMAKE_SKIP_RPATH:BOOL=NO \
 -DCMAKE_BUILD_TYPE:STRING=Release \
 -DBoost_INCLUDE_DIR:PATH=%{_includedir} \
 -DBoost_PYTHON3_LIBRARY_RELEASE:FILEPATH=%{_libdir}/libboost_python%{python3_version_nodots}.so \
 -DCMAKE_VERBOSE_MAKEFILE:BOOL=TRUE \
 -DLEMON_EXECUTABLE:FILEPATH=%{_bindir}/lemon \
 -DPYTHON_INCLUDE_DIR:PATH=%{_includedir}/python%{python3_version}$(python3-config --abiflags) \
 -DPYTHON_LIBRARY:FILEPATH=%{_libdir}/libpython%{python3_version}$(python3-config --abiflags).so \
 -DZLIB_INCLUDE_DIR:PATH=%{_includedir} -DPNG_LIBRARY_RELEASE:FILEPATH=%{_libdir}/libpng.so \
 -DPNG_PNG_INCLUDE_DIR:PATH=%{_includedir} -DZLIB_LIBRARY_RELEASE:FILEPATH=%{_libdir}/libz.so \
 -DQt5Concurrent_DIR:PATH=%{_libdir}/cmake/Qt5Concurrent \
 -DQt5Core_DIR:PATH=%{_libdir}/cmake/Qt5Core \
 -DQt5Gui_DIR:PATH=%{_libdir}4/cmake/Qt5Gui \
 -DQt5Network_DIR:PATH=%{_libdir}/cmake/Qt5Network \
 -DQt5OpenGL_DIR:PATH=%{_libdir}/cmake/Qt5OpenGL \
 -DQt5Widgets_DIR:PATH=%{_libdir}/cmake/Qt5Widgets ..

%make_build

%install
%make_install -C build

mkdir -p $RPM_BUILD_ROOT%{python3_sitelib}
mkdir -p $RPM_BUILD_ROOT%{_datadir}/icons/antimony

mv $RPM_BUILD_ROOT%{_datadir}/antimony/fab $RPM_BUILD_ROOT%{python3_sitelib}
install -pm 644 deploy/icon.svg $RPM_BUILD_ROOT%{_datadir}/icons/antimony/%{name}.svg

##Make a .desktop file
mkdir -p $RPM_BUILD_ROOT%{_datadir}/applications
cat > $RPM_BUILD_ROOT%{_datadir}/applications/%{name}.desktop <<EOF
[Desktop Entry]
Type=Application
Version=1.0
Name=Antimony
Comment=Tree-based Modeler
GenericName=CAD Application
Exec=antimony %f
Icon=%{_datadir}/icons/antimony/%{name}.svg
Terminal=false
Categories=Graphics;Science;Engineering;
MimeType=application/x-extension-sb;application/x-antimony;
StartupWMClass=antimony
EOF

# Make an appdata file
mkdir -p $RPM_BUILD_ROOT%{_datadir}/metainfo
cat > $RPM_BUILD_ROOT%{_datadir}/metainfo/%{name}.appdata.xml <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop">
  <id type="desktop">antimony.desktop</id>
  <metadata_license>CC0-1.0</metadata_license>
  <name>antimony</name>
  <project_license>MIT</project_license>
  <summary>Computer-aided design CAD tool</summary>
  <categories>
   <category>Graphics</category>
   <category>Science</category>
  </categories>
  <description>
    <p>
      Antimony is a computer-aided design (CAD) tool from a
     parallel universe in which CAD software evolved
     from Lisp machines rather than drafting tables.
    </p>
    <p>
     Antimony provides the Python3 Fab module that is
     a set of software tools for personal fabrication,
     intended for use with machines common to fab labs.
     For info about Fab visit kokompe.cba.mit.edu/.
    </p>  
  </description>
  <url type="homepage">http://www.mattkeeter.com/projects/antimony/3/</url>
  <screenshots>
    <screenshot type="default">
     <image>https://sagitter.fedorapeople.org/antimony-screenshots/antimony1.png</image>
    </screenshot>
    <screenshot>
     <image>https://sagitter.fedorapeople.org/antimony-screenshots/antimony2.png</image>
    </screenshot>
    <screenshot>
     <image>https://sagitter.fedorapeople.org/antimony-screenshots/antimony3.png</image>
    </screenshot>
  </screenshots>
  <updatecontact>sagitter_at_fedoraproject.org</updatecontact>
</component>
EOF

%check
desktop-file-validate $RPM_BUILD_ROOT%{_datadir}/applications/%{name}.desktop
%if 0%{?fedora}
appstream-util validate-relax --nonet $RPM_BUILD_ROOT%{_datadir}/metainfo/*.appdata.xml
%endif

%files
%doc README.md doc/*.md
%license LICENSE
%{_bindir}/antimony
%{python3_sitelib}/fab/
%{_datadir}/antimony/
%{_datadir}/icons/antimony/
%{_datadir}/applications/%{name}.desktop
%{_datadir}/metainfo/%{name}.appdata.xml

%changelog
* Tue Jan 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.3-17
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild

* Thu Oct 03 2019 Miro Hron훾ok <mhroncok@redhat.com> - 0.9.3-16
- Rebuilt for Python 3.8.0rc1 (#1748018)

* Mon Aug 19 2019 Miro Hron훾ok <mhroncok@redhat.com> - 0.9.3-15
- Rebuilt for Python 3.8

* Wed Jul 24 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.3-14
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild

* Mon Jun 03 2019 Antonio Trande <sagitter@fedoraproject.org> - 0.9.3-13
- Use abiflags

* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.3-12
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

* Wed Jan 30 2019 Jonathan Wakely <jwakely@redhat.com> - 0.9.3-11
- Use %%{python3_version_nodots} for Boost.Python library name

* Tue Jan 29 2019 Jonathan Wakely <jwakely@redhat.com> - 0.9.3-11
- Rebuilt for Boost 1.69

* Thu Jan 24 2019 Jonathan Wakely <jwakely@redhat.com> - 0.9.3-10
- Rebuilt for Boost 1.69

* Thu Jul 12 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.3-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

* Fri Jun 29 2018 Antonio Trande <sagitter@fedoraproject.org> - 0.9.3-8
- Fix compiling error with Python37

* Tue Jun 19 2018 Miro Hron훾ok <mhroncok@redhat.com> - 0.9.3-7
- Rebuilt for Python 3.7

* Wed Feb 21 2018 Antonio Trande <sagitter@fedoraproject.org> - 0.9.3-6
- Add gcc gcc-c++ BR

* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.3-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Tue Jan 23 2018 Jonathan Wakely <jwakely@redhat.com> - 0.9.3-4
- Rebuilt for Boost 1.66

* Sun Jan 07 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 0.9.3-3
- Remove obsolete scriptlets

* Tue Dec 19 2017 Antonio Trande <sagitter@fedoraproject.org> - 0.9.3-2
- Appdata file moved into metainfo data directory

* Sun Nov 26 2017 Antonio Trande <sagitter@fedoraproject.org> - 0.9.3-1
- 0.9.3 stable release

* Wed Aug 02 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.3-0.11.20161128git41a770
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild

* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.3-0.10.20161128git41a770
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Wed Jul 19 2017 Jonathan Wakely <jwakely@redhat.com> - 0.9.3-0.9.20161128git41a770
- Rebuilt for s390x binutils bug

* Tue Jul 18 2017 Jonathan Wakely <jwakely@redhat.com> - 0.9.3-0.8.20161128git41a770
- Rebuilt for Boost 1.64

* Mon May 15 2017 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.3-0.7.20161128git41a770
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_27_Mass_Rebuild

* Wed Feb 15 2017 Igor Gnatenko <ignatenko@redhat.com> - 0.9.3-0.6.20161128git41a770
- Rebuild for brp-python-bytecompile

* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.3-0.5.20161128git41a770
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Tue Feb 07 2017 Antonio Trande <sagitterATfedoraproject.org> 0.9.3-0.4.2016070741a770
- Rebuild for boost-1.63

* Thu Jan 05 2017 Antonio Trande <sagitterATfedoraproject.org> 0.9.3-0.3.2016070741a770
- Conformed to new rules for scriptlets

* Mon Dec 19 2016 Miro Hron훾ok <mhroncok@redhat.com> - 0.9.3-0.2.20161128git41a770
- Rebuild for Python 3.6

* Mon Nov 28 2016 Antonio Trande <sagitter@fedoraproject.org> - 0.9.3-0.1.2016070741a770
- Update to 0.9.3b (commit b9f01e)

* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.2-0.4.20160707gitb9f01e
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages

* Sun Jul 10 2016 Antonio Trande <sagitter@fedoraproject.org> - 0.9.2-0.3.20160707gitb9f01e
- Update to 0.9.2b (commit b9f01e) (bz#1284676)

* Mon Jul 04 2016 Antonio Trande <sagitter@fedoraproject.org> - 0.9.2-0.2
- Fix patch

* Mon Jul 04 2016 Antonio Trande <sagitter@fedoraproject.org> - 0.9.2-0.1
- Update to 0.9.2 (pre-release)
- Change build-system to CMake

* Mon May 23 2016 Antonio Trande <sagitter@fedoraproject.org> - 0.9.1-0.1
- Update to 0.9.1 (pre-release)

* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.0-0.7.20151126git4118b9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Sat Jan 23 2016 Antonio Trande <sagitter@fedoraproject.org> - 0.9.0-0.6.20151126git4118b9
- Rebuild for Boost-1.60
- Update to commit #4118b9

* Sun Nov 15 2015 Antonio Trande <sagitter@fedoraproject.org> - 0.9.0-0.5.20151111git12e9f8
- Fixed link to the Python3 library

* Thu Nov 12 2015 Antonio Trande <sagitter@fedoraproject.org> - 0.9.0-0.4.20151111git12e9f8
- Update to commit #12e9f8

* Thu Nov 12 2015 Antonio Trande <sagitter@fedoraproject.org> - 0.9.0-0.3.20151031git5c144c
- Fixed appdata file
- Removed Python3 Provides macro
- Used %%autosetup macro

* Fri Nov 06 2015 Antonio Trande <sagitter@fedoraproject.org> - 0.9.0-0.2.20151031git5c144c
- Update to commit #c144cc
- Hardened build on Fedora 22
- Added an appdata file

* Tue Aug 11 2015 Antonio Trande <sagitter@fedoraproject.org> - 0.9.0-0.1.20150811gitf389cb
- First package