The cirros image was rebuilt against the 3.13.0-83 kernel, drivers e1000e, igbvf...
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / pkg-perl.mk
1 ################################################################################
2 # Perl package infrastructure
3 #
4 # This file implements an infrastructure that eases development of
5 # package .mk files for Perl packages.
6 #
7 # See the Buildroot documentation for details on the usage of this
8 # infrastructure
9 #
10 # In terms of implementation, this perl infrastructure requires
11 # the .mk file to only specify metadata information about the
12 # package: name, version, download URL, etc.
13 #
14 # We still allow the package .mk file to override what the different
15 # steps are doing, if needed. For example, if <PKG>_BUILD_CMDS is
16 # already defined, it is used as the list of commands to perform to
17 # build the package, instead of the default perl behaviour. The
18 # package can also define some post operation hooks.
19 #
20 ################################################################################
21
22 PERL_ARCHNAME = $(ARCH)-linux
23 PERL_RUN = PERL5LIB= $(HOST_DIR)/usr/bin/perl
24
25 ################################################################################
26 # inner-perl-package -- defines how the configuration, compilation and
27 # installation of a perl package should be done, implements a
28 # few hooks to tune the build process for perl specifities and
29 # calls the generic package infrastructure to generate the necessary
30 # make targets
31 #
32 #  argument 1 is the lowercase package name
33 #  argument 2 is the uppercase package name, including a HOST_ prefix
34 #             for host packages
35 #  argument 3 is the uppercase package name, without the HOST_ prefix
36 #             for host packages
37 #  argument 4 is the type (target or host)
38 ################################################################################
39
40 define inner-perl-package
41
42 $(2)_DEPENDENCIES += host-perl
43
44 #
45 # Configure step. Only define it if not already defined by the package
46 # .mk file. And take care of the differences between host and target
47 # packages.
48 #
49 ifndef $(2)_CONFIGURE_CMDS
50 ifeq ($(4),target)
51
52 # Configure package for target
53 define $(2)_CONFIGURE_CMDS
54         cd $$($$(PKG)_SRCDIR) && if [ -f Build.PL ] ; then \
55                 $$($(2)_CONF_ENV) \
56                 PERL_MM_USE_DEFAULT=1 \
57                 $$(PERL_RUN) Build.PL \
58                         --config ar="$$(TARGET_AR)" \
59                         --config full_ar="$$(TARGET_AR)" \
60                         --config cc="$$(TARGET_CC)" \
61                         --config ccflags="$$(TARGET_CFLAGS)" \
62                         --config optimize=" " \
63                         --config ld="$$(TARGET_CC)" \
64                         --config lddlflags="-shared $$(TARGET_LDFLAGS)" \
65                         --config ldflags="$$(TARGET_LDFLAGS)" \
66                         --include_dirs $$(STAGING_DIR)/usr/lib/perl5/$$(PERL_VERSION)/$$(PERL_ARCHNAME)/CORE \
67                         --destdir $$(TARGET_DIR) \
68                         --installdirs vendor \
69                         --install_path lib=/usr/lib/perl5/site_perl/$$(PERL_VERSION) \
70                         --install_path arch=/usr/lib/perl5/site_perl/$$(PERL_VERSION)/$$(PERL_ARCHNAME) \
71                         --install_path bin=/usr/bin \
72                         --install_path script=/usr/bin \
73                         --install_path bindoc=/usr/share/man/man1 \
74                         --install_path libdoc=/usr/share/man/man3 \
75                         $$($(2)_CONF_OPTS); \
76         else \
77                 $$($(2)_CONF_ENV) \
78                 PERL_MM_USE_DEFAULT=1 \
79                 PERL_AUTOINSTALL=--skipdeps \
80                 $$(PERL_RUN) Makefile.PL \
81                         AR="$$(TARGET_AR)" \
82                         FULL_AR="$$(TARGET_AR)" \
83                         CC="$$(TARGET_CC)" \
84                         CCFLAGS="$$(TARGET_CFLAGS)" \
85                         OPTIMIZE=" " \
86                         LD="$$(TARGET_CC)" \
87                         LDDLFLAGS="-shared $$(TARGET_LDFLAGS)" \
88                         LDFLAGS="$$(TARGET_LDFLAGS)" \
89                         DESTDIR=$$(TARGET_DIR) \
90                         INSTALLDIRS=vendor \
91                         INSTALLVENDORLIB=/usr/lib/perl5/site_perl/$$(PERL_VERSION) \
92                         INSTALLVENDORARCH=/usr/lib/perl5/site_perl/$$(PERL_VERSION)/$$(PERL_ARCHNAME) \
93                         INSTALLVENDORBIN=/usr/bin \
94                         INSTALLVENDORSCRIPT=/usr/bin \
95                         INSTALLVENDORMAN1DIR=/usr/share/man/man1 \
96                         INSTALLVENDORMAN3DIR=/usr/share/man/man3 \
97                         $$($(2)_CONF_OPTS); \
98         fi
99 endef
100 else
101
102 # Configure package for host
103 define $(2)_CONFIGURE_CMDS
104         cd $$($$(PKG)_SRCDIR) && if [ -f Build.PL ] ; then \
105                 $$($(2)_CONF_ENV) \
106                 PERL_MM_USE_DEFAULT=1 \
107                 $$(PERL_RUN) Build.PL \
108                         $$($(2)_CONF_OPTS); \
109         else \
110                 $$($(2)_CONF_ENV) \
111                 PERL_MM_USE_DEFAULT=1 \
112                 PERL_AUTOINSTALL=--skipdeps \
113                 $$(PERL_RUN) Makefile.PL \
114                         $$($(2)_CONF_OPTS); \
115         fi
116 endef
117 endif
118 endif
119
120 #
121 # Build step. Only define it if not already defined by the package .mk
122 # file. And take care of the differences between host and target
123 # packages.
124 #
125 ifndef $(2)_BUILD_CMDS
126 ifeq ($(4),target)
127
128 # Build package for target
129 define $(2)_BUILD_CMDS
130         cd $$($$(PKG)_SRCDIR) && if [ -f Build.PL ] ; then \
131                 $$(PERL_RUN) Build $$($(2)_BUILD_OPTS) build; \
132         else \
133                 $$(MAKE1) \
134                         PERL_INC=$$(STAGING_DIR)/usr/lib/perl5/$$(PERL_VERSION)/$$(PERL_ARCHNAME)/CORE \
135                         $$($(2)_BUILD_OPTS) pure_all; \
136         fi
137 endef
138 else
139
140 # Build package for host
141 define $(2)_BUILD_CMDS
142         cd $$($$(PKG)_SRCDIR) && if [ -f Build.PL ] ; then \
143                 $$(PERL_RUN) Build $$($(2)_BUILD_OPTS) build; \
144         else \
145                 $$(MAKE1) $$($(2)_BUILD_OPTS) pure_all; \
146         fi
147 endef
148 endif
149 endif
150
151 #
152 # Host installation step. Only define it if not already defined by the
153 # package .mk file.
154 #
155 ifndef $(2)_INSTALL_CMDS
156 define $(2)_INSTALL_CMDS
157         cd $$($$(PKG)_SRCDIR) && if [ -f Build.PL ] ; then \
158                 $$(PERL_RUN) Build $$($(2)_INSTALL_TARGET_OPTS) install; \
159         else \
160                 $$(MAKE1) $$($(2)_INSTALL_TARGET_OPTS) pure_install; \
161         fi
162 endef
163 endif
164
165 #
166 # Target installation step. Only define it if not already defined by
167 # the package .mk file.
168 #
169 ifndef $(2)_INSTALL_TARGET_CMDS
170 define $(2)_INSTALL_TARGET_CMDS
171         cd $$($$(PKG)_SRCDIR) && if [ -f Build.PL ] ; then \
172                 $$(PERL_RUN) Build $$($(2)_INSTALL_TARGET_OPTS) install; \
173         else \
174                 $$(MAKE1) $$($(2)_INSTALL_TARGET_OPTS) pure_install; \
175         fi
176 endef
177 endif
178
179 # Call the generic package infrastructure to generate the necessary
180 # make targets
181 $(call inner-generic-package,$(1),$(2),$(3),$(4))
182
183 endef
184
185 ################################################################################
186 # perl-package -- the target generator macro for Perl packages
187 ################################################################################
188
189 perl-package = $(call inner-perl-package,$(pkgname),$(call UPPERCASE,$(pkgname)),$(call UPPERCASE,$(pkgname)),target)
190 host-perl-package = $(call inner-perl-package,host-$(pkgname),$(call UPPERCASE,host-$(pkgname)),$(call UPPERCASE,$(pkgname)),host)