source: packages/lang/perl/Makefile @ 12374

Last change on this file since 12374 was 12374, checked in by nico, 8 years ago

fix perl/microperl builds

  • Property copyright set to Copyright (C) 2006 OpenWrt.org
  • Property licence set to GPLv2
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.2 KB
Line 
1#
2# Copyright (C) 2006-2008 OpenWrt.org
3#
4# This is free software, licensed under the GNU General Public License v2.
5# See /LICENSE for more information.
6#
7# $Id$
8
9include $(TOPDIR)/rules.mk
10
11PKG_NAME:=perl
12PKG_VERSION:=5.10.0
13PKG_RELEASE:=1
14PKG_MD5SUM:=d2c39b002ebfd2c3c5dba589365c5a71
15
16PKG_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
20PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
21PKG_CAT:=zcat
22
23PKG_BUILD_DIR:=$(BUILD_DIR)/perl/$(PKG_NAME)-$(PKG_VERSION)
24
25include $(INCLUDE_DIR)/package.mk
26
27define Package/perl/Default
28  SUBMENU:=Perl
29  SECTION:=lang
30  CATEGORY:=Languages
31  TITLE:=The Perl intepreter
32  URL:=http://www.perl.com/
33endef
34
35define Package/microperl
36$(call Package/perl/Default)
37  TITLE+=(minimal version)
38endef
39
40define Package/microperl/description
41 A perl package without operating-specific functions such as readdir.
42endef
43
44define Build/Template
45
46$(STAMP_CONFIGURED)-$(1): $(STAMP_PREPARED)
47        -$(MAKE) -C $(PKG_BUILD_DIR) clean
48        $(call Build/$(1)/Configure)
49        touch $$@
50
51$(STAMP_BUILT)-$(1): $(STAMP_CONFIGURED)-$(1)
52        $(call Build/$(1)/Compile)
53        touch $$@
54
55$(STAMP_BUILT): $(STAMP_BUILT)-$(1)
56
57endef
58
59define Build/microperl/Configure
60endef
61
62define 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/
67endef
68
69define Package/microperl/install
70        $(INSTALL_DIR) $(1)/usr/bin
71        $(INSTALL_BIN) $(PKG_BUILD_DIR)/microperl $(1)/usr/bin/
72endef
73
74include perlmod.mk
75
76define Package/perl
77$(call Package/perl/Default)
78  MAINTAINER:=Peter Colberg <peter@petercolberg.org>
79endef
80
81define 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.
85endef
86
87define Build/perl/Configure
88        @echo
89        @echo "===> Stage 1: Configure host perl"
90        @echo
91        mkdir -p $(PKG_BUILD_DIR)/host-perl
92        (cd $(PKG_BUILD_DIR)/host-perl && sh ../Configure -der -Dmksymlinks -Uusedl)
93
94        @echo
95        @echo "===> Stage 2: Build host perl binary with static extensions"
96        @echo
97        $(MAKE) -C $(PKG_BUILD_DIR)/host-perl
98
99        @echo
100        @echo "===> Stage 3: Configure target perl"
101        @echo
102        -$(MAKE) -C $(PKG_BUILD_DIR) clean
103        sed \
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)
115endef
116
117define Build/perl/Compile
118        @echo
119        @echo "===> Stage 4: Build target miniperl binary"
120        @echo
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/
126
127        @echo
128        @echo "===> Stage 5: Build target perl binary"
129        @echo
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/
135
136        @echo
137        @echo "===> Stage 6: Build target extensions and utils"
138        @echo
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)
144
145        @echo
146        @echo "===> Stage 7: Install Perl into staging dir"
147        @echo
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))
151
152        @echo
153        @echo "===> Stage 8: Install Perl into a temporary root"
154        @echo
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))
160endef
161
162define 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
166endef
167
168ifneq ($(CONFIG_PACKAGE_microperl),)
169define Build/microperl
170        $(call Build/Template,microperl)
171endef
172endif
173$(eval $(Build/microperl))
174
175ifneq ($(CONFIG_PACKAGE_perl),)
176define Build/perl
177        $(call Build/Template,perl)
178endef
179endif
180$(eval $(Build/perl))
181
182define Build/Configure
183endef
184
185define Build/Compile
186endef
187
188$(eval $(call BuildPackage,microperl))
189$(eval $(call BuildPackage,perl))
190
191$(eval $(call RequireCommand,rsync, \
192        $(PKG_NAME) requires rsync installed on the host-system. \
193))
194
195-include perlbase.mk
Note: See TracBrowser for help on using the repository browser.