2 # Copyright (C) 2006-2011 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 include $(TOPDIR
)/rules.mk
13 PKG_MD5SUM
:=d2c39b002ebfd2c3c5dba589365c5a71
15 PKG_SOURCE_URL
:=ftp
://ftp.cpan.org
/pub
/CPAN
/src
/5.0 \
16 ftp
://ftp.mpi-sb.mpg.de
/pub
/perl
/CPAN
/src
/5.0 \
17 ftp
://ftp.gmd.de
/mirrors
/CPAN
/src
/5.0 \
18 ftp
://ftp.funet.fi
/pub
/languages
/perl
/CPAN
/src
/5.0
19 PKG_SOURCE
:=$(PKG_NAME
)-$(PKG_VERSION
).
tar.gz
21 PKG_BUILD_DIR
:=$(BUILD_DIR
)/perl
/$(PKG_NAME
)-$(PKG_VERSION
)
23 include $(INCLUDE_DIR
)/package.mk
25 ifneq ($(CONFIG_USE_EGLIBC
)$(CONFIG_USE_GLIBC
),)
27 EXTRA_LIBDIRS
:=$(STAGING_DIR
)/lib
30 define Package
/perl
/Default
34 TITLE
:=The Perl intepreter
35 URL
:=http
://www.perl.com
/
36 DEPENDS
:=+USE_EGLIBC
:libbsd
+USE_GLIBC
:libbsd
39 define Package
/microperl
40 $(call Package
/perl
/Default
)
41 TITLE
+=(minimal version
)
44 define Package
/microperl
/description
45 A perl package without operating-specific functions such
as readdir.
50 $(STAMP_CONFIGURED
)-$(1): $(STAMP_PREPARED
)
51 -$(MAKE
) -C
$(PKG_BUILD_DIR
) clean
52 $(call Build
/$(1)/Configure
)
55 $(STAMP_BUILT
)-$(1): $(STAMP_CONFIGURED
)-$(1)
56 $(call Build
/$(1)/Compile
)
59 $(STAMP_BUILT
): $(STAMP_BUILT
)-$(1)
63 define Build
/microperl
/Configure
66 define Build
/microperl
/Compile
67 $(MAKE
) -C
$(PKG_BUILD_DIR
) -f Makefile.micro \
68 CC
="$(TARGET_CC)" OPTIMIZE
="$(TARGET_CFLAGS)"
69 $(INSTALL_DIR
) $(PKG_INSTALL_DIR
)/usr
/bin
/
70 $(CP
) $(PKG_BUILD_DIR
)/microperl
$(PKG_INSTALL_DIR
)/usr
/bin
/
73 define Package
/microperl
/install
74 $(INSTALL_DIR
) $(1)/usr
/bin
75 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/microperl
$(1)/usr
/bin
/
81 $(call Package
/perl
/Default
)
84 define Package
/perl
/description
85 Perl is a stable
, cross platform programming language.
86 It is used for mission critical projects in the public and private sectors
87 and is widely used to program web applications of
all needs.
90 define Build
/perl
/Configure
92 @echo
"===> Stage 1: Configure host perl"
94 mkdir
-p
$(PKG_BUILD_DIR
)/host-perl
95 (cd
$(PKG_BUILD_DIR
)/host-perl
&& sh ..
/Configure
-der
-Dmksymlinks
-Uusedl
-Dotherlibdirs
=$(PERL_LIB
))
98 @echo
"===> Stage 2: Build host perl binary with static extensions"
100 $(MAKE
) -C
$(PKG_BUILD_DIR
)/host-perl
103 @echo
"===> Stage 3: Configure target perl"
105 -$(MAKE
) -C
$(PKG_BUILD_DIR
) clean
107 -e
's!%%CC%%!$(TARGET_CC)!g' \
108 -e
's!%%CFLAGS%%!$(TARGET_CFLAGS) -DUSE_CROSS_COMPILE $(TARGET_CPPFLAGS)!g' \
109 -e
's!%%CPP%%!$(TARGET_CROSS)gcc -E!g' \
110 -e
's!%%AR%%!$(TARGET_CROSS)ar!g' \
111 -e
's!%%LD%%!$(TARGET_CROSS)gcc!g' \
112 -e
's!%%LDFLAGS%%!-rdynamic $(TARGET_LDFLAGS)!g' \
113 -e
's!%%LIBDIRS%%!$(STAGING_DIR)/lib $(STAGING_DIR)/usr/lib!g' \
114 -e
's!%%INCDIRS%%!$(STAGING_DIR)/include $(STAGING_DIR)/usr/include!g' \
115 -e
's!%%EXTRA_PERLLIBS%%!$(EXTRA_LIBS:%=-l%)!g' \
116 -e
's!%%EXTRA_PERLLIBDIRS%%!$(EXTRA_LIBDIRS:%=-L%)!g' \
117 files
/config.sh-
$(patsubst i386
,i486
,$(ARCH
)).in \
118 > $(PKG_BUILD_DIR
)/config.sh
119 (cd
$(PKG_BUILD_DIR
) && .
/Configure
-S
)
122 define Build
/perl
/Compile
124 @echo
"===> Stage 4: Build target miniperl binary"
126 install -m
0644 $(PKG_BUILD_DIR
)/config.h
$(PKG_BUILD_DIR
)/xconfig.h
127 -rm -f
$(PKG_BUILD_DIR
)/miniperl
128 $(MAKE
) -C
$(PKG_BUILD_DIR
) miniperl
129 mkdir
-p
$(PKG_BUILD_DIR
)/target-bin
130 install -m
0755 $(PKG_BUILD_DIR
)/miniperl
$(PKG_BUILD_DIR
)/target-bin
/
133 @echo
"===> Stage 5: Build target perl binary"
135 -rm -f
$(PKG_BUILD_DIR
)/miniperl
$(PKG_BUILD_DIR
)/perl
136 install -m
0755 $(PKG_BUILD_DIR
)/host-perl
/miniperl
$(PKG_BUILD_DIR
)/
137 touch
$(PKG_BUILD_DIR
)/miniperl
138 $(MAKE
) -C
$(PKG_BUILD_DIR
) perl
139 install -m
0755 $(PKG_BUILD_DIR
)/perl
$(PKG_BUILD_DIR
)/target-bin
/
142 @echo
"===> Stage 6: Build target extensions and utils"
144 -rm -f
$(PKG_BUILD_DIR
)/miniperl
$(PKG_BUILD_DIR
)/perl
145 install -m
0755 $(PKG_BUILD_DIR
)/host-perl
/miniperl
$(PKG_BUILD_DIR
)/
146 ln
-sf miniperl
$(PKG_BUILD_DIR
)/perl
147 touch
$(PKG_BUILD_DIR
)/miniperl
$(PKG_BUILD_DIR
)/perl
148 $(MAKE
) -C
$(PKG_BUILD_DIR
)
151 @echo
"===> Stage 7: Install Perl into staging dir"
153 -rm -f
$(PKG_BUILD_DIR
)/perl
154 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/host-perl
/perl
$(PKG_BUILD_DIR
)/
155 (cd
$(PKG_BUILD_DIR
) && .
/perl installperl
--destdir
=$(STAGING_DIR
))
158 @echo
"===> Stage 8: Install Perl into a temporary root"
160 -rm -f
$(PKG_BUILD_DIR
)/perl
161 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/target-bin
/perl
$(PKG_BUILD_DIR
)
162 -rm -rf
$(PKG_INSTALL_DIR
)
163 mkdir
-p
$(PKG_INSTALL_DIR
)
164 (cd
$(PKG_BUILD_DIR
) && host-perl
/miniperl installperl
--destdir
=$(PKG_INSTALL_DIR
))
167 define Package
/perl
/install
168 $(INSTALL_DIR
) $(1)/usr
/bin
169 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/bin
/perl
$(PKG_VERSION
) $(1)/usr
/bin
170 ln
-nsf perl
$(PKG_VERSION
) $(1)/usr
/bin
/perl
173 ifneq ($(CONFIG_PACKAGE_microperl
),)
174 define Build
/microperl
175 $(call Build
/Template
,microperl
)
178 $(eval
$(Build
/microperl
))
180 ifneq ($(CONFIG_PACKAGE_perl
),)
182 $(call Build
/Template
,perl
)
185 $(eval
$(Build
/perl
))
187 define Build
/Configure
193 $(eval
$(call RequireCommand
,rsync
, \
194 $(PKG_NAME
) requires rsync installed on the host-system. \
197 $(eval
$(call BuildPackage
,microperl
))
198 $(eval
$(call BuildPackage
,perl
))