Blob Blame History Raw
%global  checkout   41a770ddbd3200cacf6301247a224da3ac6f9ff8
%global  date       20161128

Name:    antimony
Summary: Computer-aided design CAD tool
Version: 0.9.3
Release: 0.1.%{date}git%(echo %{checkout} | cut -c-6)%{?dist}
License: MIT
URL:     http://www.mattkeeter.com/projects/antimony/3/
Source0: https://github.com/mkeeter/antimony/archive/%{version}b.tar.gz#/%{name}-%{version}b.tar.gz

##Set compiler flags
Patch0: antimony-set_flags.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

%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
%setup -q -n %{name}-%{version}b
%patch0 -p0

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

sed -e 's|@@optflags@@|%{optflags} -fPIC -pie -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
export LDFLAGS="%{__global_ldflags} -fPIC -pie"
%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_python3.so \
 -DCMAKE_VERBOSE_MAKEFILE:BOOL=TRUE \
 -DLEMON_EXECUTABLE:FILEPATH=%{_bindir}/lemon \
 -DPYTHON_INCLUDE_DIR:PATH=%{_includedir}/python%{python3_version}m \
 -DPYTHON_LIBRARY:FILEPATH=%{_libdir}/libpython%{python3_version}m.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 %{?_smp_mflags} V=1

%install
make -C build install DESTDIR=$RPM_BUILD_ROOT

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}/appdata
cat > $RPM_BUILD_ROOT%{_datadir}/appdata/%{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

%post
/bin/touch --no-create %{_datadir}/icons/Antimony &>/dev/null || :
/usr/bin/update-desktop-database &> /dev/null || :

%postun
if [ $1 -eq 0 ] ; then
    /bin/touch --no-create %{_datadir}/icons/Antimony &>/dev/null
    /usr/bin/gtk-update-icon-cache %{_datadir}/icons/Antimony &>/dev/null || :
fi
/usr/bin/update-desktop-database &> /dev/null || :

%posttrans
/usr/bin/gtk-update-icon-cache %{_datadir}/icons/Antimony &>/dev/null || :

%check
desktop-file-validate $RPM_BUILD_ROOT%{_datadir}/applications/%{name}.desktop
%if 0%{?fedora}
appstream-util validate-relax --nonet $RPM_BUILD_ROOT%{_datadir}/appdata/*.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}/appdata/%{name}.appdata.xml

%changelog
* 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