[packages/*] remove special treatment when using glibc - support got dropped
[openwrt/svn-archive/archive.git] / lang / perl / Makefile
1 #
2 # Copyright (C) 2006-2011 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=perl
11 PKG_VERSION:=5.10.0
12 PKG_RELEASE:=7
13 PKG_MD5SUM:=d2c39b002ebfd2c3c5dba589365c5a71
14
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
20
21 PKG_BUILD_DIR:=$(BUILD_DIR)/perl/$(PKG_NAME)-$(PKG_VERSION)
22
23 include $(INCLUDE_DIR)/package.mk
24
25 ifneq ($(CONFIG_USE_EGLIBC),)
26 EXTRA_LIBS:=bsd
27 EXTRA_LIBDIRS:=$(STAGING_DIR)/lib
28 endif
29
30 define Package/perl/Default
31 SUBMENU:=Perl
32 SECTION:=lang
33 CATEGORY:=Languages
34 TITLE:=The Perl intepreter
35 URL:=http://www.perl.com/
36 DEPENDS:=+USE_EGLIBC:libbsd
37 endef
38
39 define Package/microperl
40 $(call Package/perl/Default)
41 TITLE+=(minimal version)
42 endef
43
44 define Package/microperl/description
45 A perl package without operating-specific functions such as readdir.
46 endef
47
48 define Build/Template
49
50 $(STAMP_CONFIGURED)-$(1): $(STAMP_PREPARED)
51 -$(MAKE) -C $(PKG_BUILD_DIR) clean
52 $(call Build/$(1)/Configure)
53 touch $$@
54
55 $(STAMP_BUILT)-$(1): $(STAMP_CONFIGURED)-$(1)
56 $(call Build/$(1)/Compile)
57 touch $$@
58
59 $(STAMP_BUILT): $(STAMP_BUILT)-$(1)
60
61 endef
62
63 define Build/microperl/Configure
64 endef
65
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/
71 endef
72
73 define Package/microperl/install
74 $(INSTALL_DIR) $(1)/usr/bin
75 $(INSTALL_BIN) $(PKG_BUILD_DIR)/microperl $(1)/usr/bin/
76 endef
77
78 include perlmod.mk
79
80 define Package/perl
81 $(call Package/perl/Default)
82 endef
83
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.
88 endef
89
90 define Build/perl/Configure
91 @echo
92 @echo "===> Stage 1: Configure host perl"
93 @echo
94 mkdir -p $(PKG_BUILD_DIR)/host-perl
95 (cd $(PKG_BUILD_DIR)/host-perl && sh ../Configure -der -Dmksymlinks -Uusedl -Dotherlibdirs=$(PERL_LIB))
96
97 @echo
98 @echo "===> Stage 2: Build host perl binary with static extensions"
99 @echo
100 $(MAKE) -C $(PKG_BUILD_DIR)/host-perl
101
102 @echo
103 @echo "===> Stage 3: Configure target perl"
104 @echo
105 -$(MAKE) -C $(PKG_BUILD_DIR) clean
106 sed \
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)
120 endef
121
122 define Build/perl/Compile
123 @echo
124 @echo "===> Stage 4: Build target miniperl binary"
125 @echo
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/
131
132 @echo
133 @echo "===> Stage 5: Build target perl binary"
134 @echo
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/
140
141 @echo
142 @echo "===> Stage 6: Build target extensions and utils"
143 @echo
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)
149
150 @echo
151 @echo "===> Stage 7: Install Perl into staging dir"
152 @echo
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))
156
157 @echo
158 @echo "===> Stage 8: Install Perl into a temporary root"
159 @echo
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))
165 endef
166
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
171 endef
172
173 ifneq ($(CONFIG_PACKAGE_microperl),)
174 define Build/microperl
175 $(call Build/Template,microperl)
176 endef
177 endif
178 $(eval $(Build/microperl))
179
180 ifneq ($(CONFIG_PACKAGE_perl),)
181 define Build/perl
182 $(call Build/Template,perl)
183 endef
184 endif
185 $(eval $(Build/perl))
186
187 define Build/Configure
188 endef
189
190 define Build/Compile
191 endef
192
193 $(eval $(call RequireCommand,rsync, \
194 $(PKG_NAME) requires rsync installed on the host-system. \
195 ))
196
197 $(eval $(call BuildPackage,microperl))
198 $(eval $(call BuildPackage,perl))
199
200 -include perlbase.mk