Add mirror
[openwrt.git] / package / popt / 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_LIBPOPT := ipkg/libpopt
16 I_LIBPOPT_DEV := ipkg/libpopt-dev
17
18 BUILD_DEPS := \
19
20 CONFIGURE_OPTS = \
21         --enable-shared \
22         --enable-static \
23
24 ##
25
26 all: package
27
28
29 .stamp-configured: $(BUILD_DEPS)
30
31         rm -rf config.cache
32         $(TARGET_CONFIGURE_OPTS) \
33         CFLAGS="$(TARGET_CFLAGS)" \
34         am_cv_func_iconv=no \
35         ./configure \
36           --target=$(GNU_TARGET_NAME) \
37           --host=$(GNU_TARGET_NAME) \
38           --build=$(GNU_HOST_NAME) \
39           --program-prefix="" \
40           --program-suffix="" \
41           --prefix=/usr \
42           --exec-prefix=/usr \
43           --bindir=/usr/bin \
44           --datadir=/usr/share \
45           --includedir=/usr/include \
46           --infodir=/usr/share/info \
47           --libdir=/usr/lib \
48           --libexecdir=/usr/lib \
49           --localstatedir=/var \
50           --mandir=/usr/share/man \
51           --sbindir=/usr/sbin \
52           --sysconfdir=/etc \
53           $(DISABLE_LARGEFILE) \
54           $(DISABLE_NLS) \
55           $(CONFIGURE_OPTS) \
56
57         touch .stamp-configured
58
59
60 .stamp-built: .stamp-configured
61
62         $(MAKE)
63           
64         touch .stamp-built
65
66
67 $(INSTALL_DIR)/usr/include/popt.h: .stamp-built
68
69         mkdir -p $(INSTALL_DIR)
70
71         $(MAKE) \
72           DESTDIR="$(INSTALL_DIR)" \
73          install
74
75
76 configure: .stamp-configured
77
78
79 build: .stamp-built
80
81
82 install: $(INSTALL_DIR)/usr/include/popt.h
83
84
85 package: $(INSTALL_DIR)/usr/include/popt.h
86
87         mkdir -p $(I_LIBPOPT)/usr/lib
88         cp -fpR $(INSTALL_DIR)/usr/lib/libpopt*.so.* $(I_LIBPOPT)/usr/lib/
89         $(STRIP) $(I_LIBPOPT)/usr/lib/lib*.so.*
90
91         mkdir -p $(I_LIBPOPT_DEV)/usr/include
92         cp -fpR $(INSTALL_DIR)/usr/include/popt.h $(I_LIBPOPT_DEV)/usr/include/
93         mkdir -p $(I_LIBPOPT_DEV)/usr/lib
94         cp -fpR $(INSTALL_DIR)/usr/lib/libpopt*.a $(I_LIBPOPT_DEV)/usr/lib/
95         cp -fpR $(INSTALL_DIR)/usr/lib/libpopt*.so* $(I_LIBPOPT_DEV)/usr/lib/
96
97         chmod 0755 ipkg/*/CONTROL/
98         chmod 0644 ipkg/*/CONTROL/control
99         
100         perl -pi -e "s/^Arch.*:.*/Architecture: $(ARCH)/g" ipkg/*/CONTROL/control
101 ifneq ($(strip $(PKG_VERSION)),)
102         perl -pi -e "s/^Vers.*:.*/Version: $(PKG_VERSION)/g" ipkg/*/CONTROL/control
103 endif
104
105         $(IPKG_BUILD) $(I_LIBPOPT) $(IPKG_TARGET_DIR)
106         $(IPKG_BUILD) $(I_LIBPOPT_DEV) $(IPKG_TARGET_DIR)
107
108
109 clean:
110
111         -$(MAKE) \
112           DESTDIR="$(INSTALL_DIR)" \
113          uninstall clean
114
115         rm -rf .stamp-* \
116           $(I_LIBPOPT)/usr \
117           $(I_LIBPOPT_DEV)/usr \
118
119
120 control:
121
122         @cat $(I_LIBPOPT)/CONTROL/control
123         @echo
124         @cat $(I_LIBPOPT_DEV)/CONTROL/control
125         @echo
126         
127
128 .PHONY: configure build install package clean control