2 # Copyright (C) 2006-2009 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
22 PKG_BUILD_DIR:=$(BUILD_DIR)/perl/$(PKG_NAME)-$(PKG_VERSION)
24 include $(INCLUDE_DIR)/package.mk
26 define Package/perl/Default
30 TITLE:=The Perl intepreter
31 URL:=http://www.perl.com/
34 define Package/microperl
35 $(call Package/perl/Default)
36 TITLE+=(minimal version)
39 define Package/microperl/description
40 A perl package without operating-specific functions such as readdir.
45 $(STAMP_CONFIGURED)-$(1): $(STAMP_PREPARED)
46 -$(MAKE) -C $(PKG_BUILD_DIR) clean
47 $(call Build/$(1)/Configure)
50 $(STAMP_BUILT)-$(1): $(STAMP_CONFIGURED)-$(1)
51 $(call Build/$(1)/Compile)
54 $(STAMP_BUILT): $(STAMP_BUILT)-$(1)
58 define Build/microperl/Configure
61 define Build/microperl/Compile
62 $(MAKE) -C $(PKG_BUILD_DIR) -f Makefile.micro \
63 CC="$(TARGET_CC)" OPTIMIZE="$(TARGET_CFLAGS)"
64 mkdir -p $(PKG_INSTALL_DIR)/usr/bin/
65 $(CP) $(PKG_BUILD_DIR)/microperl $(PKG_INSTALL_DIR)/usr/bin/
68 define Package/microperl/install
69 $(INSTALL_DIR) $(1)/usr/bin
70 $(INSTALL_BIN) $(PKG_BUILD_DIR)/microperl $(1)/usr/bin/
76 $(call Package/perl/Default)
77 MAINTAINER:=Peter Colberg <peter@petercolberg.org>
80 define Package/perl/description
81 Perl is a stable, cross platform programming language.
82 It is used for mission critical projects in the public and private sectors
83 and is widely used to program web applications of all needs.
86 define Build/perl/Configure
88 @echo "===> Stage 1: Configure host perl"
90 mkdir -p $(PKG_BUILD_DIR)/host-perl
91 (cd $(PKG_BUILD_DIR)/host-perl && sh ../Configure -der -Dmksymlinks -Uusedl)
94 @echo "===> Stage 2: Build host perl binary with static extensions"
96 $(MAKE) -C $(PKG_BUILD_DIR)/host-perl
99 @echo "===> Stage 3: Configure target perl"
101 -$(MAKE) -C $(PKG_BUILD_DIR) clean
103 -e 's!%%CC%%!$(TARGET_CC)!g' \
104 -e 's!%%CFLAGS%%!$(TARGET_CFLAGS) -DUSE_CROSS_COMPILE $(TARGET_CPPFLAGS)!g' \
105 -e 's!%%CPP%%!$(TARGET_CROSS)gcc -E!g' \
106 -e 's!%%AR%%!$(TARGET_CROSS)ar!g' \
107 -e 's!%%LD%%!$(TARGET_CROSS)gcc!g' \
108 -e 's!%%LDFLAGS%%!-rdynamic $(TARGET_LDFLAGS)!g' \
109 -e 's!%%LIBDIRS%%!$(STAGING_DIR)/lib $(STAGING_DIR)/usr/lib!g' \
110 -e 's!%%INCDIRS%%!$(STAGING_DIR)/include $(STAGING_DIR)/usr/include!g' \
111 files/config.sh-$(patsubst i386,i486,$(ARCH)).in \
112 > $(PKG_BUILD_DIR)/config.sh
113 (cd $(PKG_BUILD_DIR) && ./Configure -S)
116 define Build/perl/Compile
118 @echo "===> Stage 4: Build target miniperl binary"
120 install -m 0644 $(PKG_BUILD_DIR)/config.h $(PKG_BUILD_DIR)/xconfig.h
121 -rm -f $(PKG_BUILD_DIR)/miniperl
122 $(MAKE) -C $(PKG_BUILD_DIR) miniperl
123 mkdir -p $(PKG_BUILD_DIR)/target-bin
124 install -m 0755 $(PKG_BUILD_DIR)/miniperl $(PKG_BUILD_DIR)/target-bin/
127 @echo "===> Stage 5: Build target perl binary"
129 -rm -f $(PKG_BUILD_DIR)/miniperl $(PKG_BUILD_DIR)/perl
130 install -m 0755 $(PKG_BUILD_DIR)/host-perl/miniperl $(PKG_BUILD_DIR)/
131 touch $(PKG_BUILD_DIR)/miniperl
132 $(MAKE) -C $(PKG_BUILD_DIR) perl
133 install -m 0755 $(PKG_BUILD_DIR)/perl $(PKG_BUILD_DIR)/target-bin/
136 @echo "===> Stage 6: Build target extensions and utils"
138 -rm -f $(PKG_BUILD_DIR)/miniperl $(PKG_BUILD_DIR)/perl
139 install -m 0755 $(PKG_BUILD_DIR)/host-perl/miniperl $(PKG_BUILD_DIR)/
140 ln -sf miniperl $(PKG_BUILD_DIR)/perl
141 touch $(PKG_BUILD_DIR)/miniperl $(PKG_BUILD_DIR)/perl
142 $(MAKE) -C $(PKG_BUILD_DIR)
145 @echo "===> Stage 7: Install Perl into staging dir"
147 -rm -f $(PKG_BUILD_DIR)/perl
148 $(INSTALL_BIN) $(PKG_BUILD_DIR)/host-perl/perl $(PKG_BUILD_DIR)/
149 (cd $(PKG_BUILD_DIR) && ./perl installperl --destdir=$(STAGING_DIR))
152 @echo "===> Stage 8: Install Perl into a temporary root"
154 -rm -f $(PKG_BUILD_DIR)/perl
155 $(INSTALL_BIN) $(PKG_BUILD_DIR)/target-bin/perl $(PKG_BUILD_DIR)
156 -rm -rf $(PKG_INSTALL_DIR)
157 mkdir -p $(PKG_INSTALL_DIR)
158 (cd $(PKG_BUILD_DIR) && host-perl/miniperl installperl --destdir=$(PKG_INSTALL_DIR))
161 define Package/perl/install
162 $(INSTALL_DIR) $(1)/usr/bin
163 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/perl$(PKG_VERSION) $(1)/usr/bin
164 ln -f $(1)/usr/bin/perl$(PKG_VERSION) $(1)/usr/bin/perl
167 ifneq ($(CONFIG_PACKAGE_microperl),)
168 define Build/microperl
169 $(call Build/Template,microperl)
172 $(eval $(Build/microperl))
174 ifneq ($(CONFIG_PACKAGE_perl),)
176 $(call Build/Template,perl)
179 $(eval $(Build/perl))
181 define Build/Configure
187 $(eval $(call BuildPackage,microperl))
188 $(eval $(call BuildPackage,perl))
190 $(eval $(call RequireCommand,rsync, \
191 $(PKG_NAME) requires rsync installed on the host-system. \