mjg / rpms / portmidi

Forked from rpms/portmidi 6 years ago
Clone
272c92b
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
9ac4231
%global with_gcj %{!?_without_gcj:1}%{?_without_gcj:0}
98cd245
Summary:        Real-time Midi I/O Library
98cd245
Name:           portmidi
272c92b
Version:        200
Daniel Drake 71ae99f
Release:        5%{?dist}
98cd245
License:        MIT
98cd245
Group:          System Environment/Libraries
98cd245
URL:            http://portmedia.sourceforge.net/
98cd245
Source0:        http://downloads.sourceforge.net/portmedia/%{name}-src-%{version}.zip
9ac4231
Source1:        pmdefaults.desktop
9ac4231
# Build fixes:
9ac4231
Patch0:         portmidi-cmake.patch
98cd245
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
9ac4231
BuildRequires:  alsa-lib-devel
9ac4231
BuildRequires:  cmake
9ac4231
BuildRequires:  desktop-file-utils
9ac4231
BuildRequires:  java-devel >= 1.5
9ac4231
BuildRequires:  jpackage-utils
272c92b
BuildRequires:  python-devel
9ac4231
BuildRequires:  doxygen
9ac4231
BuildRequires:  tex(latex)
9ac4231
BuildRequires:    java-gcj-compat-devel >= 1.0.31
98cd245
98cd245
%description
98cd245
PortMedia is a set of simple clean APIs and cross-platform library
98cd245
implementations for music and other media. PortMidi subproject provides a
98cd245
real-time MIDI input/output library. This package contains the PortMidi
9ac4231
libraries.
98cd245
98cd245
%package devel
98cd245
Summary:        Headers for developing programs that will use %{name}
98cd245
Group:          System Environment/Libraries
98cd245
Requires:       %{name} = %{version}-%{release}
98cd245
98cd245
%description devel
98cd245
PortMedia is a set of simple clean APIs and cross-platform library
98cd245
implementations for music and other media. PortMidi subproject provides a
98cd245
real-time MIDI input/output library. This package contains the header files
98cd245
and the documentation of PortMidi libraries.
98cd245
272c92b
%package -n python-%{name}
272c92b
Summary:        Python wrapper for %{name}
272c92b
Group:          System Environment/Libraries
272c92b
Requires:       %{name} = %{version}-%{release}
272c92b
272c92b
%description -n python-%{name}
272c92b
PortMedia is a set of simple clean APIs and cross-platform library
272c92b
implementations for music and other media. PortMidi subproject provides a
272c92b
real-time MIDI input/output library. This package contains the python
272c92b
bindings of PortMidi libraries. It can send and receive MIDI data in
272c92b
real-time from Python.
272c92b
9ac4231
%package tools
Daniel Drake 71ae99f
Summary:          Tools to configure and use %{name}
Daniel Drake 71ae99f
Group:            Applications/Multimedia
Daniel Drake 71ae99f
Requires:         hicolor-icon-theme
Daniel Drake 71ae99f
Requires:         java >= 1.5
Daniel Drake 71ae99f
Requires:         jpackage-utils
Daniel Drake 71ae99f
Requires:         %{name} = %{version}-%{release}
Daniel Drake 71ae99f
Requires(post):   java-gcj-compat >= 1.0.31
Daniel Drake 71ae99f
Requires(postun): java-gcj-compat >= 1.0.31
9ac4231
9ac4231
%description tools
9ac4231
PortMedia is a set of simple clean APIs and cross-platform library
9ac4231
implementations for music and other media. PortMidi subproject provides a
9ac4231
real-time MIDI input/output library. This package contains the PortMidi
9ac4231
configuration utility "pmdefaults" and some test applications.
98cd245
98cd245
%prep
98cd245
%setup -q -n %{name}
9ac4231
%patch0 -p1 -b .buildfix
9ac4231
9ac4231
# ewwww... binaries
9ac4231
rm -f portmidi_cdt.zip */*.exe */*/*.exe
98cd245
9ac4231
# Fix permissons and encoding issues:
98cd245
find . -name "*.c" -exec chmod -x {} \;
98cd245
find . -name "*.h" -exec chmod -x {} \;
9ac4231
for i in *.txt */*.txt */*/*.txt ; do
9ac4231
   chmod -x $i
98cd245
   sed 's|\r||' $i > $i.tmp
98cd245
   touch -r $i $i.tmp
98cd245
   mv -f $i.tmp $i
98cd245
done
98cd245
9ac4231
# Fedora's jni library location is different
9ac4231
sed -i 's|loadLibrary.*|load("%{_libdir}/%{name}/libpmjni.so");|' \
9ac4231
   pm_java/jportmidi/JPortMidiApi.java
9ac4231
9ac4231
# Add shebang, lib and class path
9ac4231
sed -i -e 's|^java|#!/bin/sh\njava \\\
9ac4231
   -Djava.library.path=%{_libdir}/%{name}/|' \
9ac4231
   -e 's|/usr/share/java/|%{_libdir}/%{name}/|' \
9ac4231
   pm_java/pmdefaults/pmdefaults
9ac4231
98cd245
98cd245
%build
9ac4231
export JAVA_HOME=%{java_home}
272c92b
%cmake -DCMAKE_CACHEFILE_DIR=%{_builddir}/%{name}/build -DVERSION=%{version} .
9ac4231
make %{?_smp_flags}
98cd245
98cd245
# Build the doxygen documentation:
98cd245
doxygen
98cd245
pushd latex
98cd245
   make %{?_smp_flags}
98cd245
popd
98cd245
272c92b
# Build python modules
36fe105
PYTHON_VER=$(python -c "from sys import version; print (version[:3])")
36fe105
PYTHON_INC=$(python -c "from distutils.sysconfig import get_python_inc; print get_python_inc()")
272c92b
pushd pm_python
272c92b
   gcc %{optflags} -fPIC -c -o pypm.o -I../pm_common \
36fe105
       -I../porttime -I$PYTHON_INC pypm.c
36fe105
   gcc -shared -o pypm.so  pypm.o -lportmidi -lpython$PYTHON_VER -L../build/Release
272c92b
popd
9ac4231
98cd245
%install
98cd245
rm -rf %{buildroot}
9ac4231
make install DESTDIR=%{buildroot}
a08ee9d
98cd245
# Install the test applications:
98cd245
install -d %{buildroot}%{_libdir}/%{name}
272c92b
for app in latency midiclock midithread midithru mm qtest sysex test; do
9ac4231
   install -m 0755 build/Release/$app %{buildroot}%{_libdir}/%{name}/
98cd245
done
98cd245
9ac4231
# Fedora's jni library location is different
9ac4231
mv %{buildroot}%{_libdir}/libpmjni.so \
9ac4231
   %{buildroot}%{_libdir}/%{name}/
9ac4231
mv %{buildroot}%{_javadir}/pmdefaults.jar \
9ac4231
   %{buildroot}%{_libdir}/%{name}/
9ac4231
9ac4231
# pmdefaults icon
9ac4231
mkdir -p %{buildroot}%{_datadir}/icons/hicolor/128x128/apps/
9ac4231
install -pm 644 pm_java/pmdefaults/pmdefaults-icon.png \
9ac4231
   %{buildroot}%{_datadir}/icons/hicolor/128x128/apps/
9ac4231
9ac4231
# desktop file
9ac4231
mkdir -p %{buildroot}%{_desktopdir}/
9ac4231
desktop-file-install \
272c92b
   --dir=%{buildroot}%{_desktopdir} \
9ac4231
   %{SOURCE1}
9ac4231
9ac4231
# Why don't they install this header file?
9ac4231
install -pm 644 pm_common/pmutil.h %{buildroot}%{_includedir}/
9ac4231
272c92b
# Install python modules
272c92b
mkdir -p %{buildroot}%{python_sitearch}
272c92b
install -pm 755 pm_python/pypm.so %{buildroot}%{python_sitearch}/
272c92b
821e5e8
# Remove duplicate library
821e5e8
rm -f %{buildroot}%{_libdir}/libportmidi_s.so
821e5e8
9ac4231
# AOT bits
9ac4231
%if %{with_gcj}
9ac4231
   %{_bindir}/aot-compile-rpm
9ac4231
%endif
9ac4231
98cd245
%clean
98cd245
rm -rf %{buildroot}
98cd245
98cd245
%post -p /sbin/ldconfig
98cd245
98cd245
%postun -p /sbin/ldconfig
98cd245
9ac4231
%post tools
9ac4231
%if %{with_gcj}
9ac4231
   if [ -x %{_bindir}/rebuild-gcj-db ] 
9ac4231
      then
9ac4231
      %{_bindir}/rebuild-gcj-db
9ac4231
   fi
9ac4231
%endif
9ac4231
9ac4231
%postun tools
9ac4231
%if %{with_gcj}
9ac4231
   if [ -x %{_bindir}/rebuild-gcj-db ] 
9ac4231
      then
9ac4231
      %{_bindir}/rebuild-gcj-db
9ac4231
   fi
9ac4231
%endif
9ac4231
98cd245
%files
98cd245
%defattr(-,root,root,-)
98cd245
%doc CHANGELOG.txt license.txt
9ac4231
%{_libdir}/lib*.so.*
9ac4231
9ac4231
%files tools
9ac4231
%defattr(-,root,root,-)
821e5e8
%doc pm_java/pmdefaults/README.txt pm_cl/*
9ac4231
%{_libdir}/%{name}/
9ac4231
%{_bindir}/pmdefaults
9ac4231
%{_datadir}/icons/hicolor/128x128/apps/pmdefaults-icon.png
9ac4231
%{_desktopdir}/pmdefaults.desktop
9ac4231
%if %{with_gcj}
9ac4231
%{_libdir}/gcj/%{name}/
9ac4231
%endif
9ac4231
272c92b
%files -n python-%{name}
272c92b
%defattr(-,root,root,-)
272c92b
%doc pm_python/README.txt pm_python/test.py pm_python/miniTest.py
272c92b
%{python_sitearch}/pypm.so
98cd245
98cd245
%files devel
98cd245
%defattr(-,root,root,-)
9ac4231
%doc README.txt
98cd245
%doc html latex/*.pdf
98cd245
%{_includedir}/*
9ac4231
%{_libdir}/lib*.so
98cd245
98cd245
%changelog
Daniel Drake 71ae99f
* Sat May 14 2011 Daniel Drake <dsd@laptop.org> - 200-5
Daniel Drake 71ae99f
- move Requires:Java to tools subpackage, its not needed by the main package
Daniel Drake 71ae99f
36fe105
* Fri Jul 23 2010 Orcan Ogetbil <oget [DOT] fedora [AT] gmail [DOT] com> 200-4
36fe105
- Fix python module build
36fe105
ddd1112
* Wed Jul 21 2010 David Malcolm <dmalcolm@redhat.com> - 200-3
ddd1112
- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild
ddd1112
821e5e8
* Sat Jan 30 2010 Orcan Ogetbil <oget [DOT] fedora [AT] gmail [DOT] com> 200-2
821e5e8
- Remove duplicate library
821e5e8
272c92b
* Sat Jan 30 2010 Orcan Ogetbil <oget [DOT] fedora [AT] gmail [DOT] com> 200-1
272c92b
- Update to 200.
272c92b
- Add python subpackage
272c92b
9ac4231
* Fri Nov 27 2009 Orcan Ogetbil <oget [DOT] fedora [AT] gmail [DOT] com> 184-1
9ac4231
- Update to 184. Build system uses cmake now.
9ac4231
ddd859c
* Sun Jul 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 131-4
ddd859c
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
ddd859c
a08ee9d
* Tue Feb 24 2009 Orcan Ogetbil <oget [DOT] fedora [AT] gmail [DOT] com> 131-3
a08ee9d
- Include pmutil.h in the devel package
a08ee9d
98cd245
* Tue Jan 27 2009 Orcan Ogetbil <oget [DOT] fedora [AT] gmail [DOT] com> 131-2
98cd245
- Build and add doxygen documentation
98cd245
- Preserve some timestamps
98cd245
98cd245
* Sun Jan 11 2009 Orcan Ogetbil <oget [DOT] fedora [AT] gmail [DOT] com> 131-1
98cd245
- New upstream release.
98cd245
98cd245
* Sun Dec 07 2008 Orcan Ogetbil <oget [DOT] fedora [AT] gmail [DOT] com> 82-1
98cd245
- Initial release.