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 $(2)_DEPENDENCIES += host-perl
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
49 ifndef $(2)_CONFIGURE_CMDS
52 # Configure package for target
53 define $(2)_CONFIGURE_CMDS
54 cd $$($$(PKG)_SRCDIR) && if [ -f Build.PL ] ; then \
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 \
78 PERL_MM_USE_DEFAULT=1 \
79 PERL_AUTOINSTALL=--skipdeps \
80 $$(PERL_RUN) Makefile.PL \
82 FULL_AR="$$(TARGET_AR)" \
84 CCFLAGS="$$(TARGET_CFLAGS)" \
87 LDDLFLAGS="-shared $$(TARGET_LDFLAGS)" \
88 LDFLAGS="$$(TARGET_LDFLAGS)" \
89 DESTDIR=$$(TARGET_DIR) \
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 \
102 # Configure package for host
103 define $(2)_CONFIGURE_CMDS
104 cd $$($$(PKG)_SRCDIR) && if [ -f Build.PL ] ; then \
106 PERL_MM_USE_DEFAULT=1 \
107 $$(PERL_RUN) Build.PL \
108 $$($(2)_CONF_OPTS); \
111 PERL_MM_USE_DEFAULT=1 \
112 PERL_AUTOINSTALL=--skipdeps \
113 $$(PERL_RUN) Makefile.PL \
114 $$($(2)_CONF_OPTS); \
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
125 ifndef $(2)_BUILD_CMDS
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; \
134 PERL_INC=$$(STAGING_DIR)/usr/lib/perl5/$$(PERL_VERSION)/$$(PERL_ARCHNAME)/CORE \
135 $$($(2)_BUILD_OPTS) pure_all; \
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; \
145 $$(MAKE1) $$($(2)_BUILD_OPTS) pure_all; \
152 # Host installation step. Only define it if not already defined by the
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; \
160 $$(MAKE1) $$($(2)_INSTALL_TARGET_OPTS) pure_install; \
166 # Target installation step. Only define it if not already defined by
167 # the package .mk file.
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; \
174 $$(MAKE1) $$($(2)_INSTALL_TARGET_OPTS) pure_install; \
179 # Call the generic package infrastructure to generate the necessary
181 $(call inner-generic-package,$(1),$(2),$(3),$(4))
185 ################################################################################
186 # perl-package -- the target generator macro for Perl packages
187 ################################################################################
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)