File purr-data.spec of Package purr-data
# Maintainer: <aggraef at gmail.com>
# This is Jonathan Wilkes' nw.js variant of Pd-L2Ork nick-named "Purr-Data".
# Basically, it is Pd-L2Ork with the Tk GUI replaced with a JavaScript GUI
# implemented using nw.js (http://nwjs.io/). **NOTE:** The flite (speech
# synthesis) external isn't included right now, as I couldn't find a suitable
# flite package in openSUSE. Other than that, it's basically the same package
# as the one available in the Arch User Repositories (also maintained by yours
# truly). In particular, it renames the executable and library directories so
# that it can be installed alongside pd-l2ork.
# We use a custom install prefix here so that the package can be installed
# alongside classic pd-l2ork.
%define prefix /opt/purr-data
# Extra build options: E.g., you can use 'light' instead of 'all' for a light
# build (only essential externals).
%define buildopt all
# nw.js version and architecture
%define nwjs_version 0.28.1
%ifarch x86_64
%define nwjs_arch x64
%else
%define nwjs_arch ia32
%endif
# XXXFIXME: Debianism. We use that version number for convenience here since
# we actually use the Debian snapshot (.orig tarball) to build the package. Is
# there a versioning scheme for git packages in RPM land that we should use?
Name: purr-data
Version: 2.17.0+git4829+ca592f6f
Release: 1
Summary: Interactive multimedia programming environment (nw.js variant)
Group: Productivity/Multimedia/Other
URL: https://agraef.github.io/purr-data/
License: BSD-3-Clause
Source0: %{name}_%{version}.orig.tar.gz
Source1: nwjs-sdk-v%{nwjs_version}-linux-%{nwjs_arch}.tar.gz
Source2: purr-data-rpmlintrc
BuildRequires: gcc-c++, autoconf, automake, libtool, libtirpc-devel, pkg-config, bison, flex, gtk2-devel, gtk3-devel, python-devel, ladspa-devel, alsa-devel, libjack-devel, bluez-devel, cairo-devel, Mesa-libGL-devel, glu-devel, glew-devel, gsl-devel, libMagick++-devel, libdc1394-devel, fftw3-devel, fluidsynth-devel, ftgl-devel, libgsm-devel, libjpeg8-devel, lua53-devel, libmp3lame-devel, libquicktime-devel, libraw1394-devel, speex-devel, libstk-devel, libtiff-devel, libv4l-devel, libdv-devel, libiec61883-devel, libXv-devel, libXxf86vm-devel, libvorbis-devel, zlib-devel, rsync, gconf2-devel, mozilla-nss-devel, libXtst-devel, libXss-devel
# This isn't in the official repositories, and I haven't found a package in
# the community repositories that works with purr-data, so disabled for now.
#BuildRequires: flite-devel
Recommends: xdg-utils, pulseaudio-utils, ladspa-tap-plugins, ladspa-foo-plugins, ladspa-invada-studio-plugins, ladspa-blepvco, ladspa-swh-plugins, ladspa-MCP, ladspa-cmt, ladspa-blop, ladspa-omins, dssi, ladspa-VCO, ladspa-WAH, ladspa-FIL, mda-lv2
Suggests: python, fluid-soundfont-gm
%description
This is Jonathan Wilkes' nw.js variant of Pd-L2Ork, nick-named
"Purr-Data". Basically, it is Pd-L2Ork with the Tk GUI replaced
with a JavaScript GUI implemented using nw.js (http://nwjs.io/).
Pd-L2Ork is Linux Laptop Orchestra's (L2Ork) real-time visual
programming environment for interactive multimedia. It is based
on Miller Puckette's Pure Data (Pd).
%prep
%setup -q -b 1
# copy the nw.js sources to where purr-data wants them
rm -rf pd/nw/nw
cp -a ../nwjs-sdk-v%{nwjs_version}-linux-%{nwjs_arch} pd/nw/nw
%build
#unset CFLAGS CPPFLAGS CXXFLAGS DEBUG_CFLAGS DEBUG_CXXFLAGS LDFLAGS INCLUDES
make prefix=%{prefix} %{buildopt}
%install
rm -rf $RPM_BUILD_ROOT
make install prefix=%{prefix} DESTDIR=$RPM_BUILD_ROOT
# Create a link to the executable.
mkdir -p "$RPM_BUILD_ROOT/usr/bin"
ln -sf %{prefix}/bin/pd-l2ork "$RPM_BUILD_ROOT/usr/bin/purr-data"
# Create links to the include and lib directories.
mkdir -p "$RPM_BUILD_ROOT/usr/include"
ln -sf %{prefix}/include/pd-l2ork "$RPM_BUILD_ROOT/usr/include/purr-data"
mkdir -p "$RPM_BUILD_ROOT/usr/lib"
ln -sf %{prefix}/lib/pd-l2ork "$RPM_BUILD_ROOT/usr/lib/purr-data"
# Edit bash completion file.
sed -e 's/pd-l2ork/purr-data/g' < "$RPM_BUILD_ROOT/etc/bash_completion.d/pd-l2ork" > "$RPM_BUILD_ROOT/etc/bash_completion.d/purr-data"
rm -f "$RPM_BUILD_ROOT/etc/bash_completion.d/pd-l2ork"
# For now we just remove the Emacs mode as it will conflict with the
# pd-l2ork package.
rm -rf "$RPM_BUILD_ROOT/usr/share/emacs"
# Edit the library paths in the default user.settings file so that it
# matches our install prefix.
cd "$RPM_BUILD_ROOT%{prefix}/lib/pd-l2ork"
sed -e "s!/usr/lib/pd-l2ork!%{prefix}/lib/pd-l2ork!g" -i default.settings
# Replace the pd-l2ork desktop/mime files and icons with purr-data ones, so
# that pd-l2ork can be installed alongside purr-data. Also fix up some
# glitches in the desktop files to make brp-suse.d/brp-30-desktop happy, which
# is *very* picky about categories. We also remove the K12 desktop files which
# aren't needed since K12 mode is not supported by purr-data (yet).
cd "$RPM_BUILD_ROOT/usr/share/applications"
sed -e 's/pd-l2ork/purr-data/g' -e 's/Pd-L2Ork/Purr-Data/g' -e 's/[.]xpm//g' -e 's/AudioVideo;Audio;/AudioVideo;Audio;Midi;/g' < pd-l2ork.desktop > purr-data.desktop
sed -e 's/pd-l2ork/purr-data/g' -e 's/Pd-L2Ork/Purr-Data/g' -e 's/[.]xpm//g' -e 's/AudioVideo;Audio;/AudioVideo;Audio;Midi;/g' < pd-l2ork-debug.desktop > purr-data-debug.desktop
rm -f pd-l2ork*.desktop
cd "$RPM_BUILD_ROOT/usr/share/mime/packages"
sed -e 's/pd-l2ork/purr-data/g' < pd-l2ork.xml > purr-data.xml
rm -f pd-l2ork.xml
cd "$RPM_BUILD_ROOT/usr/share/icons/hicolor/128x128/apps/"
rm -f pd-l2ork-k12*.png
mv pd-l2ork.png purr-data.png
mv pd-l2ork-red.png purr-data-red.png
cd "$RPM_BUILD_ROOT/usr/share/icons/hicolor/128x128/mimetypes/"
mv text-x-pd-l2ork.png text-x-purr-data.png
# Remove libtool archives and extra object files.
cd "$RPM_BUILD_ROOT%{prefix}"
rm -f lib/pd-l2ork/extra/*/*.la lib/pd-l2ork/extra/*/*.pd_linux_o
# Sanitize permissions.
cd "$RPM_BUILD_ROOT"
chmod -R go-w *
chmod -R a+r *
chmod a-x .%{prefix}/lib/pd-l2ork/default.settings
find .%{prefix}/lib/pd-l2ork/bin/nw -executable -not -type d -exec chmod a+x {} +
#find . -executable -name '*.pd_linux' -exec chmod a-x {} +
find . -executable -name '*.pd' -exec chmod a-x {} +
find . -executable -name '*.txt' -exec chmod a-x {} +
find . -executable -name '*.aif*' -exec chmod a-x {} +
find . -type d -exec chmod a+x {} +
%files
/etc
/opt/purr-data
/usr/bin
/usr/include
/usr/lib
/usr/share
%changelog
* Sat Aug 24 2019 Albert Graef <aggraef@gmail.com>
- Initial release