File: pkgvars.mk

package info (click to toggle)
policycoreutils 2.0.82-3
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 5,584 kB
  • ctags: 727
  • sloc: ansic: 5,661; python: 2,427; sh: 474; makefile: 442
file content (168 lines) | stat: -rw-r--r-- 7,987 bytes parent folder | download | duplicates (28)
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
############################ -*- Mode: Makefile -*- ###########################
## pkgvars.mk --- 
## Author           : Manoj Srivastava ( srivasta@glaurung.green-gryphon.com ) 
## Created On       : Sat Nov 15 02:56:30 2003
## Created On Node  : glaurung.green-gryphon.com
## Last Modified By : Manoj Srivastava
## Last Modified On : Thu Jun 15 12:05:46 2006
## Last Machine Used: glaurung.internal.golden-gryphon.com
## Update Count     : 11
## Status           : Unknown, Use with caution!
## HISTORY          : 
## Description      : This is what allows us toseparate out the top level
##                    targets, by determining which packages needto be built.
## 
## arch-tag: 75fcc720-7389-4eaa-a7ac-c556d3eac331
## 
## 
## 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 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
##
###############################################################################

# The maintainer information.
maintainer := $(shell LC_ALL=C dpkg-parsechangelog | grep ^Maintainer: | \
                sed 's/^Maintainer: *//')
email := srivasta@debian.org

# Priority of this version (or urgency, as dchanges would call it)
urgency := $(shell LC_ALL=C dpkg-parsechangelog | grep ^Urgency: | \
             sed 's/^Urgency: *//')

# Common useful variables
DEB_SOURCE_PACKAGE := $(strip $(shell egrep '^Source: ' debian/control      |       \
                                      cut -f 2 -d ':'))
DEB_VERSION        := $(strip $(shell LC_ALL=C dpkg-parsechangelog          |       \
                                      egrep '^Version:' | cut -f 2 -d ' '))
DEB_ISNATIVE       := $(strip $(shell LC_ALL=C dpkg-parsechangelog          |       \
                       perl -ne 'print if (m/^Version:/g && ! m/^Version:.*\-/);'))
DEB_DISTRIBUTION  := $(strip $(shell LC_ALL=C dpkg-parsechangelog          |        \
                                      egrep '^Distribution:' | cut -f 2 -d ' '))

DEB_PACKAGES := $(shell perl -e '                                                    \
                  $$/="";                                                            \
                  while(<>){                                                         \
                     $$p=$$1 if m/^Package:\s*(\S+)/;                                \
                     die "duplicate package $$p" if $$seen{$$p};                     \
                     $$seen{$$p}++; print "$$p " if $$p;                             \
                  }' debian/control )

DEB_INDEP_PACKAGES := $(shell perl -e '                                              \
                         $$/="";                                                     \
                         while(<>){                                                  \
                            $$p=$$1 if m/^Package:\s*(\S+)/;                         \
                            die "duplicate package $$p" if $$seen{$$p};              \
                            $$seen{$$p}++;                                           \
                            $$a=$$1 if m/^Architecture:\s*(\S+)/m;                   \
                            next unless ($$a eq "all");                              \
                            print "$$p " if $$p;                                     \
                         }' debian/control )

DEB_ARCH_PACKAGES := $(shell perl -e '                                               \
                         $$/="";                                                     \
                         while(<>){                                                  \
                            $$p=$$1 if m/^Package:\s*(\S+)/;                         \
                            die "duplicate package $$p" if $$seen{$$p};              \
                            $$seen{$$p}++;                                           \
                            $$c="";                                                  \
	                    if (/^Architecture:\s*(.*?)\s*$$/sm) {                   \
                              @a = split /\s+/, $$1 };                               \
	                      for my $$b (@a) {                                      \
                                next unless ($$b eq "$(DEB_HOST_ARCH)" ||            \
                                             $$b eq "any");                          \
                                $$c="$$p";                                           \
                            }                                                        \
                            print "$$c " if $$c;                                     \
                         }' debian/control )

# This package is what we get after removing the psuedo dirs we use in rules
package   = $(notdir $@)
DEBIANDIR = $(dir $(firstword $(MAKEFILE_LIST)))

ifeq  (,$(filter parallel=%,$(FAILS_PARALLEL_BUILD)))
  ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
    NUMJOBS = $(patsubst parallel=%,-j%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
  endif
endif

# Define canned sequences used to strip executables and libraries,
# keeping in mind the directives in DEB_BUILD_OPTIONS
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
define strip-exec
find $(TMPTOP) -type f | while read i; do                                    \
   if file -b $$i | egrep -q "^ELF.*executable"; then                        \
     strip --strip-all --remove-section=.comment --remove-section=.note $$i; \
   fi;                                                                       \
 done
endef

define strip-lib
find $(TMPTOP) -type f | while read i; do                                         \
   if file -b $$i | egrep -q "^ELF.*shared object"; then                          \
     strip --strip-unneeded --remove-section=.comment --remove-section=.note $$i; \
   fi;                                                                            \
done
endef
else
define strip-exec
@echo Not strippping executables as asked
endef

define strip-lib
@echo Not strippping libraries as asked
endef

endif

# this canned command specifies how to run dpkg-shlibs to add things
# to debian/substvars by scanning executables and libraries; this
# should suffice for the common case. Some rules files might need some
# changes to the command sequence, though
define get-shlib-deps
k=`find $(TMPTOP) -type f | ( while read i; do          \
    if file -b $$i |                                    \
      egrep -q "^ELF.*(executable.*dynamically linked|shared object)"; then   \
        j="$$j $$i";                                     \
    fi;                                                  \
done; echo $$j; )`; if [ -n "$$k" ]; then dpkg-shlibdeps $$k; fi
endef

# This canned sequence checks to see if all the libraries we link to
# actually provide some symbols needed by some executable ot library
# in the package itself.
ifeq (,$(strip $(filter nocheck,$(DEB_BUILD_OPTIONS))))
  ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
define check-libraries
echo Checking libs
xtra=$$($(SHELL) debian/common/checklibs); \
if [ -n "$$extra" ]; then                  \
  echo "Extra libraries: $$extra";         \
  exit 1;                                  \
fi
endef
  else
define check-libraries
echo Not checking libs
endef
  endif
else
define check-libraries
echo Not checking libs
endef
endif


#Local variables:
#mode: makefile
#End: