File: tarball.mk.in

package info (click to toggle)
cdbs 0.4.48
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 1,012 kB
  • ctags: 58
  • sloc: sh: 4,521; xml: 1,968; makefile: 159; perl: 64; python: 16; ansic: 7; java: 5
file content (103 lines) | stat: -rw-r--r-- 3,511 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
# -*- mode: makefile; coding: utf-8 -*-
#  # Copyright © 2003 Jeff Bailey <jbailey@debian.org>
# Description: A class for Tarball-based packages;
# facilitates unpacking into a directory and setting DEB_SRCDIR and
# DEB_BUILDDIR appropriately.  Note that tarball.mk MUST come
# *FIRST* in the list of included rules.
#
# 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, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
# 02111-1307 USA.

#PATH_RULES#

ifndef _cdbs_rules_tarball
_cdbs_rules_tarball = 1

include $(_cdbs_rules_path)/buildcore.mk$(_cdbs_makefile_suffix)

# The user developper may override this variable to choose which tarballs
# to unpack.

ifeq ($(DEB_TAR_SRCDIR),)
$(error You must specify DEB_TAR_SRCDIR)
endif

_cdbs_tarball_dir = build-tree

DEB_SRCDIR = $(_cdbs_tarball_dir)/$(DEB_TAR_SRCDIR)
DEB_BUILDDIR ?= $(DEB_SRCDIR)

# This is not my finest piece of work.
# Essentially, it's never right to unpack a tarball more than once
# so we have to emit stamps.  The stamps then have to be the rule
# we use.  Then we have to figure out what file we're working on
# based on the stamp name.  Also, tar-gzip archives can be either
# .tar.gz or .tgz.  tar-bzip archives can be either tar.bz or tar.bz2

_cdbs_tarball_stamps = $(addprefix debian/stamp-,$(DEB_TARBALL))
_cdbs_tarball_stamp_base = $(basename $(_cdbs_tarball_stamps))

ifeq ($(DEB_VERBOSE_ALL),yes)
_cdbs_tar_verbose = -v
endif

pre-build:: $(_cdbs_tarball_stamps)
ifneq (, $(config_guess_tar))
	if test -e /usr/share/misc/config.guess ; then \
		for i in $(config_guess_tar) ; do \
			cp --remove-destination /usr/share/misc/config.guess \
			$(_cdbs_tarball_dir)/$$i ; \
		done ; \
	fi
endif
ifneq (, $(config_sub_tar))
	if test -e /usr/share/misc/config.sub ; then \
		for i in $(config_sub_tar) ; do \
			cp --remove-destination /usr/share/misc/config.sub \
			$(_cdbs_tarball_dir)/$$i ; \
		done ; \
	fi
endif
ifneq (, $(config_rpath_tar))
	if test -e /usr/share/gnulib/config/config.rpath ; then \
		for i in $(config_rpath_tar) ; do \
			cp --remove-destination /usr/share/gnulib/config/config.rpath \
			$(_cdbs_tarball_dir)/$$i ; \
		done ; \
	fi
endif

$(addsuffix .tar,$(_cdbs_tarball_stamp_base)):
	tar -C $(_cdbs_tarball_dir) $(_cdbs_tar_verbose) -xf $(patsubst stamp-%,%,$(notdir $@))
	touch $@

$(addsuffix .gz,$(_cdbs_tarball_stamp_base)) $(addsuffix .tgz,$(_cdbs_tarball_stamp_base)):
	tar -C $(_cdbs_tarball_dir) $(_cdbs_tar_verbose) -xzf $(patsubst stamp-%,%,$(notdir $@))
	touch $@

$(addsuffix .bz,$(_cdbs_tarball_stamp_base)) $(addsuffix .bz2,$(_cdbs_tarball_stamp_base)):
	tar -C $(_cdbs_tarball_dir) $(_cdbs_tar_verbose) -xjf $(patsubst stamp-%,%,$(notdir $@))
	touch $@

$(addsuffix .zip,$(_cdbs_tarball_stamp_base)):
	unzip $(patsubst stamp-%,%,$(notdir $@)) -d $(_cdbs_tarball_dir)
	touch $@

cleanbuilddir::
	rm -rf $(_cdbs_tarball_dir)
# Ignore errors from this.  These stamps may not exist yet.
	-rm $(_cdbs_tarball_stamps)

endif