libfile: moved to github
[openwrt.org/packages.git] / lang / perlmod.mk
1 # This makefile simplifies perl module builds.
2 #
3
4 # Build environment
5 PERL_CMD := $(STAGING_DIR)/usr/bin/perl
6 PERL_LIB := $(STAGING_DIR)/usr/lib/perl5/5.10
7
8 # Module install prefix
9 PERL_SITELIB := /usr/lib/perl5/5.10
10
11 define perlmod/Configure
12 (cd $(PKG_BUILD_DIR); \
13 PERL5LIB=$(PERL_LIB) \
14 PERL_MM_USE_DEFAULT=1 \
15 $(2) \
16 $(PERL_CMD) Makefile.PL \
17 $(1) \
18 PERL_LIB=$(PERL_LIB) \
19 PERL_ARCHLIB=$(PERL_LIB) \
20 INSTALLSITELIB=$(PERL_SITELIB) \
21 INSTALLSITEARCH=$(PERL_SITELIB) \
22 DESTDIR=$(PKG_INSTALL_DIR) \
23 );
24 endef
25
26 define perlmod/Compile
27 PERL5LIB=$(PERL_LIB) \
28 $(2) \
29 $(MAKE) -C $(PKG_BUILD_DIR) \
30 $(1) \
31 install
32 endef
33
34 define perlmod/Install
35 $(INSTALL_DIR) $(strip $(1))$(PERL_SITELIB)
36 (cd $(PKG_INSTALL_DIR)$(PERL_SITELIB) && \
37 rsync --relative -rlHp --itemize-changes \
38 --exclude=\*.pod \
39 --exclude=.packlist \
40 $(addprefix --exclude=/,$(strip $(3))) \
41 --prune-empty-dirs \
42 $(strip $(2)) $(strip $(1))$(PERL_SITELIB))
43
44 chmod -R u+w $(strip $(1))$(PERL_SITELIB)
45
46 @echo "---> Stripping modules in: $(strip $(1))$(PERL_SITELIB)"
47 find $(strip $(1))$(PERL_SITELIB) -name \*.pm -or -name \*.pl | \
48 xargs -r sed -i \
49 -e '/^=\(head\|pod\|item\|over\|back\)/,/^=cut/d' \
50 -e '/^=\(head\|pod\|item\|over\|back\)/,$$$$d' \
51 -e '/^#$$$$/d' \
52 -e '/^#[^!"'"'"']/d'
53 endef
54
comments