File: octave-pkg.mk

package info (click to toggle)
octave-pkg-dev 1.4.4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 104 kB
  • ctags: 36
  • sloc: perl: 176; sh: 88; makefile: 7
file content (126 lines) | stat: -rw-r--r-- 4,403 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# -*- makefile -*-
# octave-pkg.mk: CDBS-based debian/rules scrap for building/installing
#                octave-forge pkg add-ons
# This file is part of the octave-pkg-dev Debian package

# Copyright (c) 2008  Olafur Jens SigurĂ°sson <ojsbug@gmail.com>
# Copyright (c) 2008, 2009, 2012  Rafael Laboissiere <rafael@laboissiere.net>
#
# 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 3 of the License, 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, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.

include /usr/share/cdbs/1/rules/debhelper.mk

export package = $(shell awk '/^Package:/ {print $$2; exit 0}' debian/control)
export debpkg = debian/$(package)
export shrpkg = /usr/share/octave/debian
# The directories below are versioned.  We only support the packages for the
# stable version of Octave
export mpath = usr/share/octave/packages
export bpath = usr/lib/$(shell dpkg-architecture -qDEB_HOST_MULTIARCH)/octave/packages
hosttype = $(shell octave-config -p CANONICAL_HOST_TYPE)
export version = $(shell octave-config -p VERSION | sed 's/-rc/~rc/')
apiversion = $(shell octave-config -p API_VERSION)
export octave = /usr/bin/octave-cli
export octave_options = --no-history --silent --no-init-file --no-window-system
export global_list = global-list
export local_list = local-list
libdir = /usr/share/octave-pkg-dev

# The following variable can be overriden in debian/rules to alter the
# behavior of the tests.  Possible values are 'quiet', 'normal', and
# 'verbose'.  Users must set its value after inclusion of octave-pkg.mk.
export OCTPKG_TEST_OPT =

# The following variable can be overriden in debian/rules to alter the the
# way the tests are run.  Its is value is prepended to the octave command.
# A sensible value for it would be 'xvfb-run', but environment variables
# can be also set.  Users must set its value after inclusion of
# octave-pkg.mk.
export OCTPKG_TEST_ENV =

# The following variable can be overriden in debian/rules to prevent
# the execution of the test blocks for certian files.  This variable
# should contain a space-separated list of file names (*.m or *.cc)
# for which the unit tests should not be run.
OCTPKG_EXCLUDE_TEST =

export OCTAVE_HISTFILE=/dev/null
# even with '--no-history', Octave creates an empty .octave_hist at startup,
# resulting in 'permission denied errors on the buildds

# Export buildflags to the environment, they will be picked up by mkoctfile.
# Link with --as-needed since that drastically reduces the number of linked
# libraries.
DEB_LDFLAGS_MAINT_APPEND=-Wl,--as-needed
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk
# Oct-files ldflags are taken from the following variable
export OCT_LINK_OPTS=$(LDFLAGS)

install/$(package)::	\
	check-version	\
	create-dirs	\
	install-pkg	\
	clean-files	\
	install-docs	\
	check-pkg	\
	remove-dirs

.PHONY: check-version
check-version::
	$(libdir)/check-version

.PHONY: create-dirs
create-dirs::
	mkdir -p $(CURDIR)/$(debpkg)/$(mpath)	\
		 $(CURDIR)/$(debpkg)/$(bpath)

.PHONY: install-pkg
install-pkg::
	$(libdir)/install-pkg

.PHONY: clean-files
clean-files::
	( cd  $(shell find . -name packinfo) ; rm -f COPYING ChangeLog )

.PHONY: install-docs
install-docs::
	$(libdir)/install-docs

ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
# Compose the expression for exclusion of requested files from the find command
export excluded_files_expr = $(shell for i in $(OCTPKG_EXCLUDE_TEST) ; do echo " -a ! -name $$i " ; done)

.PHONY: check-pkg
check-pkg::
	$(libdir)/check-pkg
else
check-pkg::
endif

.PHONY: remove-dirs
remove-dirs::
	rmdir --ignore-fail-on-non-empty -p	\
		 $(CURDIR)/$(debpkg)/$(mpath)	\
		 $(CURDIR)/$(debpkg)/$(bpath)


DEB_MAKE_CLEAN_TARGET = -C src clean

clean::
ifneq ($(DEB_MAKE_CLEAN_TARGET),)
	-$(MAKE) -k $(DEB_MAKE_CLEAN_TARGET)
endif
	rm -rf inst/$(hosttype)-$(apiversion) $(global_list) $(local_list)