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
21 PKG_BUILD_DIR:=$(BUILD_DIR)/perl/$(PKG_NAME)-$(PKG_VERSION)
23 include $(INCLUDE_DIR)/package.mk
25 define Package/perl/Default
29 TITLE:=The Perl intepreter
30 URL:=http://www.perl.com/
33 define Package/microperl
34 $(call Package/perl/Default)
35 TITLE+=(minimal version)
38 define Package/microperl/description
39 A perl package without operating-specific functions such as readdir.
44 $(STAMP_CONFIGURED)-$(1): $(STAMP_PREPARED)
45 -$(MAKE) -C $(PKG_BUILD_DIR) clean
46 $(call Build/$(1)/Configure)
49 $(STAMP_BUILT)-$(1): $(STAMP_CONFIGURED)-$(1)
50 $(call Build/$(1)/Compile)
53 $(STAMP_BUILT): $(STAMP_BUILT)-$(1)
57 define Build/microperl/Configure
60 define Build/microperl/Compile
61 $(MAKE) -C $(PKG_BUILD_DIR) -f Makefile.micro \
62 CC="$(TARGET_CC)" OPTIMIZE="$(TARGET_CFLAGS)"
63 $(INSTALL_DIR) $(PKG_INSTALL_DIR)/usr/bin/
64 $(CP) $(PKG_BUILD_DIR)/microperl $(PKG_INSTALL_DIR)/usr/bin/
67 define Package/microperl/install
68 $(INSTALL_DIR) $(1)/usr/bin
69 $(INSTALL_BIN) $(PKG_BUILD_DIR)/microperl $(1)/usr/bin/
75 $(call Package/perl/Default)
76 MAINTAINER:=Peter Colberg <peter@petercolberg.org>
79 define Package/perl/description
80 Perl is a stable, cross platform programming language.
81 It is used for mission critical projects in the public and private sectors
82 and is widely used to program web applications of all needs.
85 define Build/perl/Configure
87 @echo "===> Stage 1: Configure host perl"
89 mkdir -p $(PKG_BUILD_DIR)/host-perl
90 (cd $(PKG_BUILD_DIR)/host-perl && sh ../Configure -der -Dmksymlinks -Uusedl)
93 @echo "===> Stage 2: Build host perl binary with static extensions"
95 $(MAKE) -C $(PKG_BUILD_DIR)/host-perl
98 @echo "===> Stage 3: Configure target perl"
100 -$(MAKE) -C $(PKG_BUILD_DIR) clean
102 -e 's!%%CC%%!$(TARGET_CC)!g' \
103 -e 's!%%CFLAGS%%!$(TARGET_CFLAGS) -DUSE_CROSS_COMPILE $(TARGET_CPPFLAGS)!g' \
104 -e 's!%%CPP%%!$(TARGET_CROSS)gcc -E!g' \
105 -e 's!%%AR%%!$(TARGET_CROSS)ar!g' \
106 -e 's!%%LD%%!$(TARGET_CROSS)gcc!g' \
107 -e 's!%%LDFLAGS%%!-rdynamic $(TARGET_LDFLAGS)!g' \
108 -e 's!%%LIBDIRS%%!$(STAGING_DIR)/lib $(STAGING_DIR)/usr/lib!g' \
109 -e 's!%%INCDIRS%%!$(STAGING_DIR)/include $(STAGING_DIR)/usr/include!g' \
110 files/config.sh-$(patsubst i386,i486,$(ARCH)).in \
111 > $(PKG_BUILD_DIR)/config.sh
112 (cd $(PKG_BUILD_DIR) && ./Configure -S)
115 define Build/perl/Compile
117 @echo "===> Stage 4: Build target miniperl binary"
119 install -m 0644 $(PKG_BUILD_DIR)/config.h $(PKG_BUILD_DIR)/xconfig.h
120 -rm -f $(PKG_BUILD_DIR)/miniperl
121 $(MAKE) -C $(PKG_BUILD_DIR) miniperl
122 mkdir -p $(PKG_BUILD_DIR)/target-bin
123 install -m 0755 $(PKG_BUILD_DIR)/miniperl $(PKG_BUILD_DIR)/target-bin/
126 @echo "===> Stage 5: Build target perl binary"
128 -rm -f $(PKG_BUILD_DIR)/miniperl $(PKG_BUILD_DIR)/perl
129 install -m 0755 $(PKG_BUILD_DIR)/host-perl/miniperl $(PKG_BUILD_DIR)/
130 touch $(PKG_BUILD_DIR)/miniperl
131 $(MAKE) -C $(PKG_BUILD_DIR) perl
132 install -m 0755 $(PKG_BUILD_DIR)/perl $(PKG_BUILD_DIR)/target-bin/
135 @echo "===> Stage 6: Build target extensions and utils"
137 -rm -f $(PKG_BUILD_DIR)/miniperl $(PKG_BUILD_DIR)/perl
138 install -m 0755 $(PKG_BUILD_DIR)/host-perl/miniperl $(PKG_BUILD_DIR)/
139 ln -sf miniperl $(PKG_BUILD_DIR)/perl
140 touch $(PKG_BUILD_DIR)/miniperl $(PKG_BUILD_DIR)/perl
141 $(MAKE) -C $(PKG_BUILD_DIR)
144 @echo "===> Stage 7: Install Perl into staging dir"
146 -rm -f $(PKG_BUILD_DIR)/perl
147 $(INSTALL_BIN) $(PKG_BUILD_DIR)/host-perl/perl $(PKG_BUILD_DIR)/
148 (cd $(PKG_BUILD_DIR) && ./perl installperl --destdir=$(STAGING_DIR))
151 @echo "===> Stage 8: Install Perl into a temporary root"
153 -rm -f $(PKG_BUILD_DIR)/perl
154 $(INSTALL_BIN) $(PKG_BUILD_DIR)/target-bin/perl $(PKG_BUILD_DIR)
155 -rm -rf $(PKG_INSTALL_DIR)
156 mkdir -p $(PKG_INSTALL_DIR)
157 (cd $(PKG_BUILD_DIR) && host-perl/miniperl installperl --destdir=$(PKG_INSTALL_DIR))
160 define Package/perl/install
161 $(INSTALL_DIR) $(1)/usr/bin
162 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/perl$(PKG_VERSION) $(1)/usr/bin
163 ln -nsf perl$(PKG_VERSION) $(1)/usr/bin/perl
166 ifneq ($(CONFIG_PACKAGE_microperl),)
167 define Build/microperl
168 $(call Build/Template,microperl)
171 $(eval $(Build/microperl))
173 ifneq ($(CONFIG_PACKAGE_perl),)
175 $(call Build/Template,perl)
178 $(eval $(Build/perl))
180 define Build/Configure
186 $(eval $(call RequireCommand,rsync, \
187 $(PKG_NAME) requires rsync installed on the host-system. \
190 $(eval $(call BuildPackage,microperl))
191 $(eval $(call BuildPackage,perl))