debian swirl logo

Back to the packages list csound

#!/usr/bin/make -f
# -*- mode: makefile; coding: utf-8 -*-
# Copyright © 2007-2009 Felipe Sateler 
# Copyright © 2008-2010 Jonas Smedegaard 
# Description: Main Debian packaging script for CSound
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2, or (at
# your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see .

DEB_PYTHON_MODULE_PACKAGES = python-csound python-csoundac
include /usr/share/cdbs/1/rules/upstream-tarball.mk
include /usr/share/cdbs/1/class/cmake.mk
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/python-module.mk
include /usr/share/cdbs/1/rules/utils.mk
include /usr/share/cdbs/1/class/pd.mk

DEB_UPSTREAM_URL = http://downloads.sourceforge.net/csound

# Adjustments for unusual upstream tarballs:
# * capitalized project name
# * no dash between project name and version
# * version number included in top folder inside tarball
DEB_UPSTREAM_PACKAGE = Csound
DEB_UPSTREAM_TARBALL_BASENAME_MANGLE = s/(\-|~rc[0-9])//g

DEB_UPSTREAM_TARBALL_MD5 = 9635b92a4a6d7c8882fb00b89f51e75d

# Non-DFSG license: limited to educational and research purposes
DEB_UPSTREAM_REPACKAGE_EXCLUDES = ./Opcodes/scansyn*
# Embedded tarball contains possibly source-less python binary
DEB_UPSTREAM_REPACKAGE_EXCLUDES += ./csound5_osx_installer_files.tar.gz
# Contains explicit copyright but lack licensing info
DEB_UPSTREAM_REPACKAGE_EXCLUDES += ./samples/VintageDreamsWaves-v2.sf2
# Unused, includes code from other projects
DEB_UPSTREAM_REPACKAGE_EXCLUDES += ./dependencies/
# Unused, we are already repackaging
DEB_UPSTREAM_REPACKAGE_EXCLUDES += ./iOS/ ./android/ ./emscripten/ ./installer/

# Skip some data files, in addition to the default debian files
DEB_COPYRIGHT_CHECK_IGNORE_REGEX = ^(samples/hrtf-.*\.dat|debian/(changelog|copyright(|_hints|_newhints)))$

# Common docs for all packages
DEB_INSTALL_DOCS_ALL = README.md AUTHORS

# Core options of csound
DEB_CMAKE_EXTRA_FLAGS = \
		-DBUILD_RELEASE=ON \
		-DFAIL_MISSING=ON \
		-DUSE_DOUBLE=ON \
		-DUSE_GETTEXT=ON \
		-DBUILD_STATIC_LIBRARY=OFF \
		-DUSE_OPEN_MP=ON \
		-DUSE_LRINT=ON \
		-DBUILD_UTILITIES=ON \
		-DBUILD_NEW_PARSER=ON \
		-DNEW_PARSER_DEBUG=OFF \
		-DBUILD_MULTI_CORE=ON \
		-DBUILD_CATALOG=OFF \
		-DBUILD_TESTS=OFF \
		-DUSE_COMPILER_OPTIMIZATIONS=OFF \

ifneq "$(filter amd64 i386, $(DEB_HOST_ARCH_CPU))" ""
	DEB_CMAKE_EXTRA_FLAGS += -DUSE_ATOMIC_BUILTINS=ON
else
	DEB_CMAKE_EXTRA_FLAGS += -DUSE_ATOMIC_BUILTINS=OFF
endif

# I/O plugins
DEB_CMAKE_EXTRA_FLAGS += \
		-DUSE_PULSEAUDIO=ON \
		-DUSE_PORTAUDIO=ON \
		-DUSE_PORTMIDI=ON \
		-DUSE_COREMIDI=OFF \
		-DUSE_AUDIOUNIT=OFF \
		-DUSE_JACK=ON
ifeq "$(DEB_HOST_ARCH_OS)" "linux"
	DEB_CMAKE_EXTRA_FLAGS += -DUSE_ALSA=ON
else
	DEB_CMAKE_EXTRA_FLAGS += -DUSE_ALSA=OFF
endif

# Optional opcodes
DEB_CMAKE_EXTRA_FLAGS += \
		-DUSE_FLTK=ON \
		-DBUILD_STK_OPCODES=ON \
		-DBUILD_VIRTUAL_KEYBOARD=ON \
		-DBUILD_DSSI_OPCODES=ON \
		-DBUILD_CHUA_OPCODES=ON \
		-DBUILD_DSSI_OPCODES=ON \
		-DBUILD_FLUID_OPCODES=ON \
		-DBUILD_JACK_OPCODES=ON \
		-DBUILD_LINEAR_ALGEBRA_OPCODES=ON \
		-DBUILD_OSC_OPCODES=ON \
		-DBUILD_IMAGE_OPCODES=ON \
		-DBUILD_PYTHON_OPCODES=ON \
		-DBUILD_LUA_OPCODES=ON \
		-DBUILD_PD_CLASS=ON \
		-DBUILD_WIIMOTE_OPCODES=OFF \
		-DBUILD_P5GLOVE_OPCODES=OFF \
		-DUSE_CURL=OFF \
		-DBUILD_VST4CS_OPCODES=OFF \
		-DBUILD_FAUST_OPCODES=OFF \
		-DBUILD_CUDA_OPCODES=OFF \
		-DBUILD_OPENCL_OPCODES=OFF \


# Language Wrappers
# TODO: build for all Python versions (not only current default one)
# Force build of only the default one
# UGLY HACK: abuse this variable to pass an appropriate -V option
DEB_DH_PYTHONHELPER_ARGS_ALL = -V $(shell pyversions -vd)
DEB_CMAKE_EXTRA_FLAGS += \
		-DBUILD_CXX_INTERFACE=ON \
		-DBUILD_PYTHON_INTERFACE=ON \
		-DBUILD_JAVA_INTERFACE=ON \
		-DBUILD_LUA_INTERFACE=ON \

# Frontends
DEB_CMAKE_EXTRA_FLAGS += \
		-DBUILD_CSBEATS=ON \
		-DUSE_SYSTEM_PORTSMF=ON \
		-DBUILD_MAX_CSOUND_TILDE=OFF \
		-DBUILD_CSOUND_AC=ON \
		-DBUILD_CSOUND_AC_PYTHON_INTERFACE=ON \
		-DBUILD_CSOUND_AC_LUA_INTERFACE=ON


# This is a huge optimization boost
ifneq "$(filter amd64 i386, $(DEB_HOST_ARCH_CPU))" ""
	MTUNE = ON
endif

# Python >= 2.6 should install to dist-packages instead of site-packages
# Since 2.5 is the only version < 2.6 we support, we test for that.
# TODO: Use simpler second form when 2.6 is default in a stable release
PYLIBPATH = usr/lib/$(cdbs_python_current_binary)/$(if $(call cdbs_streq,$(cdbs_python_current_version),2.5),site-packages,dist-packages)
#PYLIBPATH = usr/lib/$(cdbs_python_current_binary)/dist-packages
# Path with PREFIX removed
PYLIBPATH2 = lib/$(cdbs_python_current_binary)/$(if $(call cdbs_streq,$(cdbs_python_current_version),2.5),site-packages,dist-packages)

CC = $(DEB_HOST_GNU_TYPE)-gcc
CXX = $(DEB_HOST_GNU_TYPE)-g++

# Support parallel building if enabled in DEB_BUILD_OPTIONS
DEB_BUILD_PARALLEL = 1

DEB_DH_INSTALL_SOURCEDIR = debian/tmp

DEB_SCONS_INSTALL_OPTIONS = instdir=$(CURDIR)/debian/tmp
DEB_SCONS_INSTALL_TARGET = install=1


build/libcsound64-doc:: build-doxygen-stamp
build-doxygen-stamp:
		mkdir -p doc/doxygen
		cd doc && doxygen
		touch $@

# Put aside upstream cruft before build but after licensecheck
pre-build:: Custom.cmake
Custom.cmake: debian/Custom.cmake
		sed -e 's,@PYLIBPATH@,$(PYLIBPATH2),' -e 's,@MTUNE@,$(MTUNE),' \
			debian/Custom.cmake > \
			Custom.cmake

clean::
		rm -f build-arch-stamp build-indep-stamp manpages-stamp \
			build-doxygen-stamp
		rm -f Custom.cmake
		rm -rf doc/doxygen
# fail-missing stuff
		rm -f debian/cdbs-install-diff
		rm -f debian/cdbs-reduced-install-list
		rm -f debian/cdbs-reduced-package-list

TMPDIR = $(CURDIR)/debian/tmp

install/csound-data::
		mkdir -p $(CURDIR)/debian/tmp/usr/share/csound/hrtf
		cp samples/*.dat $(CURDIR)/debian/tmp/usr/share/csound/hrtf

# avoid conflict with extract
install/csound-utils::
		mv $(CURDIR)/debian/tmp/usr/bin/extract \
			$(CURDIR)/debian/tmp/usr/bin/csound_extract

install/pd-csound::
		mkdir -p $(CURDIR)/debian/tmp/usr/lib/pd/extra
		mv $(CURDIR)/debian/tmp/usr/lib/csound6~.pd_linux \
			$(CURDIR)/debian/tmp/usr/lib/pd/extra

install/libcsnd6-java::
		mkdir -p $(CURDIR)/debian/tmp/usr/share/java
		mv $(CURDIR)/debian/tmp/usr/lib/csnd6.jar \
			$(CURDIR)/debian/tmp/usr/share/java/csnd6-$(DEB_UPSTREAM_VERSION).jar
		mkdir -p $(CURDIR)/debian/tmp/usr/lib/jni
		mv $(CURDIR)/debian/tmp/usr/lib/lib_jcsound6.so \
			$(CURDIR)/debian/tmp/usr/lib/jni

install/csladspa::
		mkdir $(CURDIR)/debian/tmp/usr/lib/ladspa
		mv $(CURDIR)/debian/tmp/usr/lib/csound/*/csladspa.so \
			$(CURDIR)/debian/tmp/usr/lib/ladspa/csladspa.so

install/libcsound64-doc::
		rm -f doc/csound/html/*.md5 doc/csound/html/*.map doc/csound/html/*.dot

# Don't ship any executable examples, they don't need to be
# Currently only arch packages carry examples
common-binary-post-install-arch::
		find debian/*/usr/share/doc/*/examples -type f -executable -print0 \
			| xargs -0 chmod -v a-x

common-binary-post-install-indep::
		dh_linktree

# Make sure that all files installed is also packaged
#  * ignore debhelper-installed files (we trust dh_install*)
#  * ignore python files (too tricky to track pycentral juggling)
binary: fail-missing
fail-missing: binary-arch binary-indep list-missing
		cat debian/cdbs-package-list | sort | uniq | \
			grep -v 'DEBIAN' | \
			grep -v '/$(PYLIBPATH)' | \
			grep -v '/usr/share/doc' | \
			grep -v '/usr/share/lintian/overrides' | \
			grep -v '/usr/share/menu' | \
			grep -v '/usr/share/pyshared' | \
			grep -v '/usr/lib/pyshared' \
			> debian/cdbs-reduced-package-list
		cat debian/cdbs-install-list | sort | uniq | \
			grep -v '/$(PYLIBPATH)' | \
			grep -v '/usr/share/pyshared' | \
			grep -v '/usr/lib/pyshared' \
			> debian/cdbs-reduced-install-list
		diff -u debian/cdbs-reduced-install-list \
			debian/cdbs-reduced-package-list \
			> debian/cdbs-install-diff \
			|| true
		@if [ "`wc -l debian/cdbs-install-diff`" != "0 debian/cdbs-install-diff" ]; then \
			echo "ERROR: Differences between intermediary installed and packaged files:"; \
			echo; \
			cat debian/cdbs-install-diff; \
			echo; \
			echo "Individual binary packages may work, but whole package build failed!"; \
			exit 1; \
		fi


# Needed by upstream build process
# First, the core dependencies
CDBS_BUILD_DEPENDS += , \
	cmake (>= 2.8.3), \
		libsndfile1-dev

# Needed for I/O plugins
CDBS_BUILD_DEPENDS += , \
		libasound2-dev [linux-any], \
		libjack-dev, \
		portaudio19-dev, \
		libportmidi-dev, \
		libpulse-dev

# Language bindings
CDBS_BUILD_DEPENDS += , \
		swig, \
		liblua5.1-0-dev, \
	python-dev (>= 2.6.6-3~), \
		puredata-dev, \
		default-jdk

# Opcodes and other features
CDBS_BUILD_DEPENDS += , \
		libfltk1.1-dev, \
		libfluidsynth-dev, \
		liblo-dev, \
		fluid, \
		ladspa-sdk, \
		libboost-dev, \
		libboost-serialization-dev, \
		libpng-dev, \
		dssi-dev, \
		libstk0-dev, \
		libgmm++-dev, \
	bison (>= 2.6), \
		flex, \
		libportsmf-dev, \
		libeigen3-dev

CDBS_BUILD_DEPENDS += , cdbs (>= 0.4.111~)

Builds:

csladspa
ladspa plugin for csound
csound-data
data files used by the csound library
csound
powerful and versatile sound synthesis software
csound-utils
miscellaneous utilities for the csound system
libcsnd6-6.0
c++ bindings for the csound api
libcsnd6-java
java bindings for the csound api
libcsnd-dev
development files for csound -- c++ api
libcsound64-6.0
main library for csound
libcsound64-dev
development files for csound
libcsound64-doc
csound api documentation
libcsoundac6.0
csound algorithmic composition library
libcsoundac-dev
development files for csoundac
liblua5.1-luacsnd
lua bindings for the csound api
pd-csound
csound external for puredata
python-csoundac
python bindings for csoundac
python-csound
python bindings for csound