Change pcre packaging
[openwrt/openwrt.git] / openwrt / package / pcre / ipkg / rules
1 #!/usr/bin/make -f
2
3 ifneq ($(strip ${IPKG_RULES_INC}),)
4 include $(IPKG_RULES_INC)
5 endif
6
7 ##
8
9 PKG_VERSION := $(shell cat ./ipkg/version)
10 CURRENT_DIR := $(shell pwd)
11 INSTALL_DIR ?= $(CURRENT_DIR)/ipkg-install
12
13 unexport INSTALL_DIR
14
15 I_LIBPCRE := ipkg/libpcre
16 I_LIBPCRE_DEV := ipkg/libpcre-dev
17
18 BUILD_DEPS := \
19
20 CONFIGURE_OPTS = \
21 --enable-shared \
22 --enable-static \
23 --enable-utf8 \
24
25 ##
26
27 all: package
28
29
30 .stamp-configured: $(BUILD_DEPS)
31
32 rm -rf config.cache
33 $(TARGET_CONFIGURE_OPTS) \
34 CFLAGS="$(TARGET_CFLAGS)" \
35 ./configure \
36 --target=$(GNU_TARGET_NAME) \
37 --host=$(GNU_TARGET_NAME) \
38 --build=$(GNU_HOST_NAME) \
39 --prefix=/usr \
40 --exec-prefix=/usr \
41 --bindir=/usr/bin \
42 --datadir=/usr/share \
43 --includedir=/usr/include \
44 --infodir=/usr/share/info \
45 --libdir=/usr/lib \
46 --libexecdir=/usr/lib \
47 --localstatedir=/var \
48 --mandir=/usr/share/man \
49 --sbindir=/usr/sbin \
50 --sysconfdir=/etc \
51 $(DISABLE_LARGEFILE) \
52 $(DISABLE_NLS) \
53 $(CONFIGURE_OPTS) \
54
55 touch .stamp-configured
56
57
58 .stamp-built: .stamp-configured
59
60 $(MAKE) \
61 CC_FOR_BUILD="$(HOSTCC)" \
62 LINK_FOR_BUILD="$(HOSTCC)" \
63 CFLAGS_FOR_BUILD="" \
64 dftables
65
66 $(MAKE) \
67 $(TARGET_CONFIGURE_OPTS) \
68 CFLAGS="$(TARGET_CFLAGS)" \
69
70 touch .stamp-built
71
72
73 $(INSTALL_DIR)/usr/include/pcre.h: .stamp-built
74
75 mkdir -p $(INSTALL_DIR)
76
77 $(MAKE) \
78 DESTDIR="$(INSTALL_DIR)" \
79 install
80
81
82 configure: .stamp-configured
83
84
85 build: .stamp-built
86
87
88 install: $(INSTALL_DIR)/usr/include/pcre.h
89
90
91 package: $(INSTALL_DIR)/usr/include/pcre.h
92
93 mkdir -p $(I_LIBPCRE)/usr/lib
94 cp -fpR $(INSTALL_DIR)/usr/lib/libpcre*.so.* $(I_LIBPCRE)/usr/lib/
95 $(STRIP) $(I_LIBPCRE)/usr/lib/lib*.so.*
96
97 mkdir -p $(I_LIBPCRE_DEV)/usr/bin
98 cp -fpR $(INSTALL_DIR)/usr/bin/pcre-config $(I_LIBPCRE_DEV)/usr/bin/
99 mkdir -p $(I_LIBPCRE_DEV)/usr/include
100 cp -fpR $(INSTALL_DIR)/usr/include/pcre*.h $(I_LIBPCRE_DEV)/usr/include/
101 mkdir -p $(I_LIBPCRE_DEV)/usr/lib
102 cp -fpR $(INSTALL_DIR)/usr/lib/libpcre*.a $(I_LIBPCRE_DEV)/usr/lib/
103 cp -fpR $(INSTALL_DIR)/usr/lib/libpcre*.so* $(I_LIBPCRE_DEV)/usr/lib/
104
105 chmod 0755 ipkg/*/CONTROL/
106 chmod 0644 ipkg/*/CONTROL/control
107
108 perl -pi -e "s/^Arch.*:.*/Architecture: $(ARCH)/g" ipkg/*/CONTROL/control
109 ifneq ($(strip $(PKG_VERSION)),)
110 perl -pi -e "s/^Vers.*:.*/Version: $(PKG_VERSION)/g" ipkg/*/CONTROL/control
111 endif
112
113 $(IPKG_BUILD) $(I_LIBPCRE) $(IPKG_TARGET_DIR)
114 $(IPKG_BUILD) $(I_LIBPCRE_DEV) $(IPKG_TARGET_DIR)
115
116
117 clean:
118
119 -$(MAKE) clean
120
121 rm -rf .stamp-* \
122 $(INSTALL_DIR)/usr/bin/pcre* \
123 $(INSTALL_DIR)/usr/include/pcre* \
124 $(INSTALL_DIR)/usr/lib/libpcre* \
125 $(INSTALL_DIR)/usr/lib/pkgconfig/libpcre.pc \
126 $(INSTALL_DIR)/usr/share/man/man*/pcre* \
127 $(I_LIBPCRE)/usr \
128 $(I_LIBPCRE_DEV)/usr \
129
130
131 control:
132
133 @cat $(I_LIBPCRE)/CONTROL/control
134 @echo
135 @cat $(I_LIBPCRE_DEV)/CONTROL/control
136 @echo
137
138
139 .PHONY: configure build install package clean control