2 # Copyright (C) 2006-2008 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
9 include $(TOPDIR
)/rules.mk
14 PKG_MD5SUM
:=d2c39b002ebfd2c3c5dba589365c5a71
16 PKG_SOURCE_URL
:=ftp
://ftp.cpan.org
/pub
/CPAN
/src
/5.0 \
17 ftp
://ftp.mpi-sb.mpg.de
/pub
/perl
/CPAN
/src
/5.0 \
18 ftp
://ftp.gmd.de
/mirrors
/CPAN
/src
/5.0 \
19 ftp
://ftp.funet.fi
/pub
/languages
/perl
/CPAN
/src
/5.0
20 PKG_SOURCE
:=$(PKG_NAME
)-$(PKG_VERSION
).
tar.gz
23 PKG_BUILD_DIR
:=$(BUILD_DIR
)/perl
/$(PKG_NAME
)-$(PKG_VERSION
)
25 include $(INCLUDE_DIR
)/package.mk
27 define Package
/perl
/Default
31 TITLE
:=The Perl intepreter
32 URL
:=http
://www.perl.com
/
35 define Package
/microperl
36 $(call Package
/perl
/Default
)
37 TITLE
+=(minimal version
)
40 define Package
/microperl
/description
41 A perl package without operating-specific functions such
as readdir.
46 $(STAMP_CONFIGURED
)-$(1): $(STAMP_PREPARED
)
47 -$(MAKE
) -C
$(PKG_BUILD_DIR
) clean
48 $(call Build
/$(1)/Configure
)
51 $(STAMP_BUILT
)-$(1): $(STAMP_CONFIGURED
)-$(1)
52 $(call Build
/$(1)/Compile
)
55 $(STAMP_BUILT
): $(STAMP_BUILT
)-$(1)
59 define Build
/microperl
/Configure
62 define Build
/microperl
/Compile
63 $(MAKE
) -C
$(PKG_BUILD_DIR
) -f Makefile.micro \
64 CC
="$(TARGET_CC)" OPTIMIZE
="$(TARGET_CFLAGS)"
65 mkdir
-p
$(PKG_INSTALL_DIR
)/usr
/bin
/
66 $(CP
) $(PKG_BUILD_DIR
)/microperl
$(PKG_INSTALL_DIR
)/usr
/bin
/
69 define Package
/microperl
/install
70 $(INSTALL_DIR
) $(1)/usr
/bin
71 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/microperl
$(1)/usr
/bin
/
77 $(call Package
/perl
/Default
)
78 MAINTAINER
:=Peter Colberg
<peter@petercolberg.org
>
81 define Package
/perl
/description
82 Perl is a stable
, cross platform programming language.
83 It is used for mission critical projects in the public and private sectors
84 and is widely used to program web applications of
all needs.
87 define Build
/perl
/Configure
89 @echo
"===> Stage 1: Configure host perl"
91 mkdir
-p
$(PKG_BUILD_DIR
)/host-perl
92 (cd
$(PKG_BUILD_DIR
)/host-perl
&& sh ..
/Configure
-der
-Dmksymlinks
-Uusedl
)
95 @echo
"===> Stage 2: Build host perl binary with static extensions"
97 $(MAKE
) -C
$(PKG_BUILD_DIR
)/host-perl
100 @echo
"===> Stage 3: Configure target perl"
102 -$(MAKE
) -C
$(PKG_BUILD_DIR
) clean
104 -e
's!%%CC%%!$(TARGET_CC)!g' \
105 -e
's!%%CFLAGS%%!$(TARGET_CFLAGS) -DUSE_CROSS_COMPILE -I$(STAGING_DIR)/include -I$(STAGING_DIR)/usr/include!g' \
106 -e
's!%%CPP%%!$(TARGET_CROSS)gcc -E!g' \
107 -e
's!%%AR%%!$(TARGET_CROSS)ar!g' \
108 -e
's!%%LD%%!$(TARGET_CROSS)gcc!g' \
109 -e
's!%%LDFLAGS%%!-rdynamic -L$(STAGING_DIR)/lib -L$(STAGING_DIR)/usr/lib!g' \
110 -e
's!%%LIBDIRS%%!$(STAGING_DIR)/lib $(STAGING_DIR)/usr/lib!g' \
111 -e
's!%%INCDIRS%%!$(STAGING_DIR)/include $(STAGING_DIR)/usr/include!g' \
112 files
/config.sh-
$(REAL_GNU_TARGET_NAME
).in \
113 > $(PKG_BUILD_DIR
)/config.sh
114 (cd
$(PKG_BUILD_DIR
) && .
/Configure
-S
)
117 define Build
/perl
/Compile
119 @echo
"===> Stage 4: Build target miniperl binary"
121 install -m
0644 $(PKG_BUILD_DIR
)/config.h
$(PKG_BUILD_DIR
)/xconfig.h
122 -rm -f
$(PKG_BUILD_DIR
)/miniperl
123 $(MAKE
) -C
$(PKG_BUILD_DIR
) miniperl
124 mkdir
-p
$(PKG_BUILD_DIR
)/target-bin
125 install -m
0755 $(PKG_BUILD_DIR
)/miniperl
$(PKG_BUILD_DIR
)/target-bin
/
128 @echo
"===> Stage 5: Build target perl binary"
130 -rm -f
$(PKG_BUILD_DIR
)/miniperl
$(PKG_BUILD_DIR
)/perl
131 install -m
0755 $(PKG_BUILD_DIR
)/host-perl
/miniperl
$(PKG_BUILD_DIR
)/
132 touch
$(PKG_BUILD_DIR
)/miniperl
133 $(MAKE
) -C
$(PKG_BUILD_DIR
) perl
134 install -m
0755 $(PKG_BUILD_DIR
)/perl
$(PKG_BUILD_DIR
)/target-bin
/
137 @echo
"===> Stage 6: Build target extensions and utils"
139 -rm -f
$(PKG_BUILD_DIR
)/miniperl
$(PKG_BUILD_DIR
)/perl
140 install -m
0755 $(PKG_BUILD_DIR
)/host-perl
/miniperl
$(PKG_BUILD_DIR
)/
141 ln
-sf miniperl
$(PKG_BUILD_DIR
)/perl
142 touch
$(PKG_BUILD_DIR
)/miniperl
$(PKG_BUILD_DIR
)/perl
143 $(MAKE
) -C
$(PKG_BUILD_DIR
)
146 @echo
"===> Stage 7: Install Perl into staging dir"
148 -rm -f
$(PKG_BUILD_DIR
)/perl
149 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/host-perl
/perl
$(PKG_BUILD_DIR
)/
150 (cd
$(PKG_BUILD_DIR
) && .
/perl installperl
--destdir
=$(STAGING_DIR
))
153 @echo
"===> Stage 8: Install Perl into a temporary root"
155 -rm -f
$(PKG_BUILD_DIR
)/perl
156 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/target-bin
/perl
$(PKG_BUILD_DIR
)
157 -rm -rf
$(PKG_INSTALL_DIR
)
158 mkdir
-p
$(PKG_INSTALL_DIR
)
159 (cd
$(PKG_BUILD_DIR
) && host-perl
/miniperl installperl
--destdir
=$(PKG_INSTALL_DIR
))
162 define Package
/perl
/install
163 $(INSTALL_DIR
) $(1)/usr
/bin
164 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/bin
/perl
$(PKG_VERSION
) $(1)/usr
/bin
165 ln
-f
$(1)/usr
/bin
/perl
$(PKG_VERSION
) $(1)/usr
/bin
/perl
168 ifneq ($(CONFIG_PACKAGE_microperl
),)
169 define Build
/microperl
170 $(call Build
/Template
,microperl
)
173 $(eval
$(Build
/microperl
))
175 ifneq ($(CONFIG_PACKAGE_perl
),)
177 $(call Build
/Template
,perl
)
180 $(eval
$(Build
/perl
))
182 $(eval
$(call BuildPackage
,microperl
))
183 $(eval
$(call BuildPackage
,perl
))
185 $(eval
$(call RequireCommand
,rsync
, \
186 $(PKG_NAME
) requires rsync installed on the host-system. \