]>
Commit | Line | Data |
---|---|---|
9fbb1699 FP |
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 | ||
f268f713 | 22 | PERL_ARCHNAME = $(ARCH)-linux |
2081534c | 23 | PERL_RUN = PERL5LIB= $(HOST_DIR)/usr/bin/perl |
9fbb1699 FP |
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 | |
5bd9ed6f | 33 | # argument 2 is the uppercase package name, including a HOST_ prefix |
9fbb1699 FP |
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 | ||
2e39ffcc FP |
42 | # Target packages need both the perl interpreter on the target (for |
43 | # runtime) and the perl interpreter on the host (for | |
44 | # compilation). However, host packages only need the perl | |
45 | # interpreter on the host. | |
46 | ifeq ($(4),target) | |
47 | $(2)_DEPENDENCIES += host-perl perl | |
48 | else | |
fad24172 | 49 | $(2)_DEPENDENCIES += host-perl |
2e39ffcc | 50 | endif |
fad24172 | 51 | |
9fbb1699 FP |
52 | # |
53 | # Configure step. Only define it if not already defined by the package | |
54 | # .mk file. And take care of the differences between host and target | |
55 | # packages. | |
56 | # | |
57 | ifndef $(2)_CONFIGURE_CMDS | |
58 | ifeq ($(4),target) | |
59 | ||
60 | # Configure package for target | |
61 | define $(2)_CONFIGURE_CMDS | |
62 | cd $$($$(PKG)_SRCDIR) && if [ -f Build.PL ] ; then \ | |
734b34f5 | 63 | $$($(2)_CONF_ENV) \ |
af156db8 | 64 | PERL_MM_USE_DEFAULT=1 \ |
fad24172 | 65 | $$(PERL_RUN) Build.PL \ |
54456cc6 TDS |
66 | --config ar="$$(TARGET_AR)" \ |
67 | --config full_ar="$$(TARGET_AR)" \ | |
68 | --config cc="$$(TARGET_CC)" \ | |
69 | --config ccflags="$$(TARGET_CFLAGS)" \ | |
60578787 | 70 | --config optimize=" " \ |
54456cc6 TDS |
71 | --config ld="$$(TARGET_CC)" \ |
72 | --config lddlflags="-shared $$(TARGET_LDFLAGS)" \ | |
73 | --config ldflags="$$(TARGET_LDFLAGS)" \ | |
74 | --include_dirs $$(STAGING_DIR)/usr/lib/perl5/$$(PERL_VERSION)/$$(PERL_ARCHNAME)/CORE \ | |
9fbb1699 FP |
75 | --destdir $$(TARGET_DIR) \ |
76 | --installdirs vendor \ | |
77 | --install_path lib=/usr/lib/perl5/site_perl/$$(PERL_VERSION) \ | |
54456cc6 | 78 | --install_path arch=/usr/lib/perl5/site_perl/$$(PERL_VERSION)/$$(PERL_ARCHNAME) \ |
9fbb1699 FP |
79 | --install_path bin=/usr/bin \ |
80 | --install_path script=/usr/bin \ | |
81 | --install_path bindoc=/usr/share/man/man1 \ | |
82 | --install_path libdoc=/usr/share/man/man3 \ | |
aaffd209 | 83 | $$($(2)_CONF_OPTS); \ |
9fbb1699 | 84 | else \ |
734b34f5 | 85 | $$($(2)_CONF_ENV) \ |
af156db8 | 86 | PERL_MM_USE_DEFAULT=1 \ |
9fbb1699 | 87 | PERL_AUTOINSTALL=--skipdeps \ |
fad24172 | 88 | $$(PERL_RUN) Makefile.PL \ |
54456cc6 TDS |
89 | AR="$$(TARGET_AR)" \ |
90 | FULL_AR="$$(TARGET_AR)" \ | |
91 | CC="$$(TARGET_CC)" \ | |
92 | CCFLAGS="$$(TARGET_CFLAGS)" \ | |
60578787 | 93 | OPTIMIZE=" " \ |
54456cc6 TDS |
94 | LD="$$(TARGET_CC)" \ |
95 | LDDLFLAGS="-shared $$(TARGET_LDFLAGS)" \ | |
96 | LDFLAGS="$$(TARGET_LDFLAGS)" \ | |
9fbb1699 FP |
97 | DESTDIR=$$(TARGET_DIR) \ |
98 | INSTALLDIRS=vendor \ | |
99 | INSTALLVENDORLIB=/usr/lib/perl5/site_perl/$$(PERL_VERSION) \ | |
54456cc6 | 100 | INSTALLVENDORARCH=/usr/lib/perl5/site_perl/$$(PERL_VERSION)/$$(PERL_ARCHNAME) \ |
9fbb1699 FP |
101 | INSTALLVENDORBIN=/usr/bin \ |
102 | INSTALLVENDORSCRIPT=/usr/bin \ | |
103 | INSTALLVENDORMAN1DIR=/usr/share/man/man1 \ | |
104 | INSTALLVENDORMAN3DIR=/usr/share/man/man3 \ | |
aaffd209 | 105 | $$($(2)_CONF_OPTS); \ |
9fbb1699 FP |
106 | fi |
107 | endef | |
108 | else | |
109 | ||
110 | # Configure package for host | |
111 | define $(2)_CONFIGURE_CMDS | |
112 | cd $$($$(PKG)_SRCDIR) && if [ -f Build.PL ] ; then \ | |
734b34f5 | 113 | $$($(2)_CONF_ENV) \ |
af156db8 | 114 | PERL_MM_USE_DEFAULT=1 \ |
fad24172 | 115 | $$(PERL_RUN) Build.PL \ |
aaffd209 | 116 | $$($(2)_CONF_OPTS); \ |
9fbb1699 | 117 | else \ |
734b34f5 | 118 | $$($(2)_CONF_ENV) \ |
af156db8 | 119 | PERL_MM_USE_DEFAULT=1 \ |
9fbb1699 | 120 | PERL_AUTOINSTALL=--skipdeps \ |
fad24172 | 121 | $$(PERL_RUN) Makefile.PL \ |
aaffd209 | 122 | $$($(2)_CONF_OPTS); \ |
9fbb1699 FP |
123 | fi |
124 | endef | |
125 | endif | |
126 | endif | |
127 | ||
128 | # | |
129 | # Build step. Only define it if not already defined by the package .mk | |
130 | # file. And take care of the differences between host and target | |
131 | # packages. | |
132 | # | |
133 | ifndef $(2)_BUILD_CMDS | |
134 | ifeq ($(4),target) | |
135 | ||
136 | # Build package for target | |
137 | define $(2)_BUILD_CMDS | |
138 | cd $$($$(PKG)_SRCDIR) && if [ -f Build.PL ] ; then \ | |
fad24172 | 139 | $$(PERL_RUN) Build $$($(2)_BUILD_OPTS) build; \ |
9fbb1699 | 140 | else \ |
54456cc6 TDS |
141 | $$(MAKE1) \ |
142 | PERL_INC=$$(STAGING_DIR)/usr/lib/perl5/$$(PERL_VERSION)/$$(PERL_ARCHNAME)/CORE \ | |
a603eb1c | 143 | $$($(2)_BUILD_OPTS) pure_all; \ |
9fbb1699 FP |
144 | fi |
145 | endef | |
146 | else | |
147 | ||
148 | # Build package for host | |
149 | define $(2)_BUILD_CMDS | |
150 | cd $$($$(PKG)_SRCDIR) && if [ -f Build.PL ] ; then \ | |
fad24172 | 151 | $$(PERL_RUN) Build $$($(2)_BUILD_OPTS) build; \ |
9fbb1699 | 152 | else \ |
a603eb1c | 153 | $$(MAKE1) $$($(2)_BUILD_OPTS) pure_all; \ |
9fbb1699 FP |
154 | fi |
155 | endef | |
156 | endif | |
157 | endif | |
158 | ||
159 | # | |
160 | # Host installation step. Only define it if not already defined by the | |
161 | # package .mk file. | |
162 | # | |
163 | ifndef $(2)_INSTALL_CMDS | |
164 | define $(2)_INSTALL_CMDS | |
165 | cd $$($$(PKG)_SRCDIR) && if [ -f Build.PL ] ; then \ | |
fad24172 | 166 | $$(PERL_RUN) Build $$($(2)_INSTALL_TARGET_OPTS) install; \ |
9fbb1699 | 167 | else \ |
57f2b8d2 | 168 | $$(MAKE1) $$($(2)_INSTALL_TARGET_OPTS) pure_install; \ |
9fbb1699 FP |
169 | fi |
170 | endef | |
171 | endif | |
172 | ||
173 | # | |
174 | # Target installation step. Only define it if not already defined by | |
175 | # the package .mk file. | |
176 | # | |
177 | ifndef $(2)_INSTALL_TARGET_CMDS | |
178 | define $(2)_INSTALL_TARGET_CMDS | |
179 | cd $$($$(PKG)_SRCDIR) && if [ -f Build.PL ] ; then \ | |
fad24172 | 180 | $$(PERL_RUN) Build $$($(2)_INSTALL_TARGET_OPTS) install; \ |
9fbb1699 | 181 | else \ |
57f2b8d2 | 182 | $$(MAKE1) $$($(2)_INSTALL_TARGET_OPTS) pure_install; \ |
9fbb1699 FP |
183 | fi |
184 | endef | |
185 | endif | |
186 | ||
187 | # Call the generic package infrastructure to generate the necessary | |
188 | # make targets | |
189 | $(call inner-generic-package,$(1),$(2),$(3),$(4)) | |
190 | ||
191 | endef | |
192 | ||
193 | ################################################################################ | |
194 | # perl-package -- the target generator macro for Perl packages | |
195 | ################################################################################ | |
196 | ||
197 | perl-package = $(call inner-perl-package,$(pkgname),$(call UPPERCASE,$(pkgname)),$(call UPPERCASE,$(pkgname)),target) | |
198 | host-perl-package = $(call inner-perl-package,host-$(pkgname),$(call UPPERCASE,host-$(pkgname)),$(call UPPERCASE,$(pkgname)),host) |