1 ################################################################################
2 # Perl package infrastructure
4 # This file implements an infrastructure that eases development of
5 # package .mk files for Perl packages.
7 # See the Buildroot documentation for details on the usage of this
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.
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.
20 ################################################################################
22 PERL_ARCHNAME
= $(ARCH
)-linux
23 PERL_RUN
= PERL5LIB
= $(HOST_DIR
)/usr
/bin
/perl
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
32 # argument 1 is the lowercase package name
33 # argument 2 is the uppercase package name, including a HOST_ prefix
35 # argument 3 is the uppercase package name, without the HOST_ prefix
37 # argument 4 is the type (target or host)
38 ################################################################################
40 define inner-perl-package
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.
47 $(2)_DEPENDENCIES
+= host-perl perl
49 $(2)_DEPENDENCIES
+= host-perl
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
57 ifndef $(2)_CONFIGURE_CMDS
60 # Configure package for target
61 define $(2)_CONFIGURE_CMDS
62 cd
$$($$(PKG
)_SRCDIR
) && if
[ -f Build.PL
] ; then \
64 PERL_MM_USE_DEFAULT
=1 \
65 $$(PERL_RUN
) Build.PL \
66 --config
ar="$$(TARGET_AR)" \
67 --config full_ar
="$$(TARGET_AR)" \
68 --config
cc="$$(TARGET_CC)" \
69 --config ccflags
="$$(TARGET_CFLAGS)" \
70 --config optimize
=" " \
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 \
75 --destdir
$$(TARGET_DIR
) \
76 --installdirs vendor \
77 --install_path lib
=/usr
/lib
/perl5
/site_perl
/$$(PERL_VERSION
) \
78 --install_path arch
=/usr
/lib
/perl5
/site_perl
/$$(PERL_VERSION
)/$$(PERL_ARCHNAME
) \
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 \
86 PERL_MM_USE_DEFAULT
=1 \
87 PERL_AUTOINSTALL
=--skipdeps \
88 $$(PERL_RUN
) Makefile.PL \
90 FULL_AR
="$$(TARGET_AR)" \
92 CCFLAGS
="$$(TARGET_CFLAGS)" \
95 LDDLFLAGS
="-shared $$(TARGET_LDFLAGS)" \
96 LDFLAGS
="$$(TARGET_LDFLAGS)" \
97 DESTDIR
=$$(TARGET_DIR
) \
99 INSTALLVENDORLIB
=/usr
/lib
/perl5
/site_perl
/$$(PERL_VERSION
) \
100 INSTALLVENDORARCH
=/usr
/lib
/perl5
/site_perl
/$$(PERL_VERSION
)/$$(PERL_ARCHNAME
) \
101 INSTALLVENDORBIN
=/usr
/bin \
102 INSTALLVENDORSCRIPT
=/usr
/bin \
103 INSTALLVENDORMAN1DIR
=/usr
/share
/man
/man1 \
104 INSTALLVENDORMAN3DIR
=/usr
/share
/man
/man3 \
105 $$($(2)_CONF_OPTS
); \
110 # Configure package for host
111 define $(2)_CONFIGURE_CMDS
112 cd
$$($$(PKG
)_SRCDIR
) && if
[ -f Build.PL
] ; then \
114 PERL_MM_USE_DEFAULT
=1 \
115 $$(PERL_RUN
) Build.PL \
116 $$($(2)_CONF_OPTS
); \
119 PERL_MM_USE_DEFAULT
=1 \
120 PERL_AUTOINSTALL
=--skipdeps \
121 $$(PERL_RUN
) Makefile.PL \
122 $$($(2)_CONF_OPTS
); \
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
133 ifndef $(2)_BUILD_CMDS
136 # Build package for target
137 define $(2)_BUILD_CMDS
138 cd
$$($$(PKG
)_SRCDIR
) && if
[ -f Build.PL
] ; then \
139 $$(PERL_RUN
) Build
$$($(2)_BUILD_OPTS
) build
; \
142 PERL_INC
=$$(STAGING_DIR
)/usr
/lib
/perl5
/$$(PERL_VERSION
)/$$(PERL_ARCHNAME
)/CORE \
144 $$($(2)_BUILD_OPTS
) pure_all
; \
149 # Build package for host
150 define $(2)_BUILD_CMDS
151 cd
$$($$(PKG
)_SRCDIR
) && if
[ -f Build.PL
] ; then \
152 $$(PERL_RUN
) Build
$$($(2)_BUILD_OPTS
) build
; \
154 $$(MAKE1
) $$($(2)_BUILD_OPTS
) pure_all
; \
161 # Host installation step. Only define it if not already defined by the
164 ifndef $(2)_INSTALL_CMDS
165 define $(2)_INSTALL_CMDS
166 cd
$$($$(PKG
)_SRCDIR
) && if
[ -f Build.PL
] ; then \
167 $$(PERL_RUN
) Build
$$($(2)_INSTALL_TARGET_OPTS
) install; \
169 $$(MAKE1
) $$($(2)_INSTALL_TARGET_OPTS
) pure_install
; \
175 # Target installation step. Only define it if not already defined by
176 # the package .mk file.
178 ifndef $(2)_INSTALL_TARGET_CMDS
179 define $(2)_INSTALL_TARGET_CMDS
180 cd
$$($$(PKG
)_SRCDIR
) && if
[ -f Build.PL
] ; then \
181 $$(PERL_RUN
) Build
$$($(2)_INSTALL_TARGET_OPTS
) install; \
183 $$(MAKE1
) $$($(2)_INSTALL_TARGET_OPTS
) pure_install
; \
188 # Call the generic package infrastructure to generate the necessary
190 $(call inner-generic-package
,$(1),$(2),$(3),$(4))
194 ################################################################################
195 # perl-package -- the target generator macro for Perl packages
196 ################################################################################
198 perl-package
= $(call inner-perl-package
,$(pkgname
),$(call UPPERCASE
,$(pkgname
)),$(call UPPERCASE
,$(pkgname
)),target
)
199 host-perl-package
= $(call inner-perl-package
,host-
$(pkgname
),$(call UPPERCASE
,host-
$(pkgname
)),$(call UPPERCASE
,$(pkgname
)),host
)