Add sqlite (libsqlite and sqlite-cli) package
[openwrt/svn-archive/archive.git] / openwrt / package / sqlite / Makefile
1 # $Id$
2
3 include $(TOPDIR)/rules.mk
4
5 PKG_NAME:=sqlite
6 PKG_VERSION:=3.2.1
7 PKG_RELEASE:=1
8 PKG_MD5SUM:=ccf3831c2f67452d444c5e5e2c7ca6f0
9
10 PKG_SOURCE_URL:=http://www.sqlite.org/
11 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
12 PKG_CAT:=zcat
13
14 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
15 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
16
17 include $(TOPDIR)/package/rules.mk
18
19 $(eval $(call PKG_template,LIBSQLITE,libsqlite,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
20 $(eval $(call PKG_template,SQLITE_CLI,sqlite-cli,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
21
22 $(PKG_BUILD_DIR)/.configured:
23 (cd $(PKG_BUILD_DIR); rm -rf config.{cache,status} ; \
24 $(TARGET_CONFIGURE_OPTS) \
25 CFLAGS="$(TARGET_CFLAGS)" \
26 CPPFLAGS="-I$(STAGING_DIR)/usr/include" \
27 LDFLAGS="-L$(STAGING_DIR)/usr/lib" \
28 config_BUILD_CC="$(HOSTCC)" \
29 config_BUILD_CFLAGS="-O2" \
30 config_TARGET_CC="$(TARGET_CC)" \
31 config_TARGET_CFLAGS="$(TARGET_CFLAGS)" \
32 config_TARGET_READLINE_INC="-I$(STAGING_DIR)/usr/include" \
33 config_TARGET_READLINE_LIBS="-L$(STAGING_DIR)/usr/lib -lreadline -lncurses" \
34 ./configure \
35 --target=$(GNU_TARGET_NAME) \
36 --host=$(GNU_TARGET_NAME) \
37 --build=$(GNU_HOST_NAME) \
38 --program-prefix="" \
39 --program-suffix="" \
40 --prefix=/usr \
41 --exec-prefix=/usr \
42 --bindir=/usr/bin \
43 --datadir=/usr/share \
44 --includedir=/usr/include \
45 --infodir=/usr/share/info \
46 --libdir=/usr/lib \
47 --libexecdir=/usr/lib \
48 --localstatedir=/var \
49 --mandir=/usr/share/man \
50 --sbindir=/usr/sbin \
51 --sysconfdir=/etc \
52 $(DISABLE_LARGEFILE) \
53 $(DISABLE_NLS) \
54 --enable-shared \
55 --enable-static \
56 --disable-tcl \
57 );
58 touch $@
59
60 $(PKG_BUILD_DIR)/.built:
61 rm -rf $(PKG_INSTALL_DIR)
62 mkdir -p $(PKG_INSTALL_DIR)
63 $(MAKE) -C $(PKG_BUILD_DIR) \
64 DESTDIR="$(PKG_INSTALL_DIR)" \
65 all install
66 touch $@
67
68 $(IPKG_LIBSQLITE):
69 install -d -m0755 $(IDIR_LIBSQLITE)/usr/lib
70 cp -fpR $(PKG_INSTALL_DIR)/usr/lib/libsqlite3.so.* $(IDIR_LIBSQLITE)/usr/lib/
71 $(RSTRIP) $(IDIR_LIBSQLITE)
72 $(IPKG_BUILD) $(IDIR_LIBSQLITE) $(PACKAGE_DIR)
73
74 $(IPKG_SQLITE_CLI):
75 install -d -m0755 $(IDIR_SQLITE_CLI)/usr/bin
76 cp -fpR $(PKG_INSTALL_DIR)/usr/bin/sqlite3 $(IDIR_SQLITE_CLI)/usr/bin/
77 $(RSTRIP) $(IDIR_SQLITE_CLI)
78 $(IPKG_BUILD) $(IDIR_SQLITE_CLI) $(PACKAGE_DIR)
79
80 $(STAGING_DIR)/usr/lib/libsqlite3.so: $(PKG_BUILD_DIR)/.built
81 mkdir -p $(STAGING_DIR)/usr/include
82 cp -fpR $(PKG_INSTALL_DIR)/usr/include/sqlite3.h $(STAGING_DIR)/usr/include/
83 mkdir -p $(STAGING_DIR)/usr/lib
84 cp -fpR $(PKG_INSTALL_DIR)/usr/lib/libsqlite3.{a,so*} $(STAGING_DIR)/usr/lib/
85 mkdir -p $(STAGING_DIR)/usr/lib/pkgconfig
86 cp -fpR $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/sqlite3.pc $(STAGING_DIR)/usr/lib/pkgconfig/
87 touch $@
88
89 install-dev: $(STAGING_DIR)/usr/lib/libsqlite3.so
90
91 uninstall-dev:
92 rm -rf \
93 $(STAGING_DIR)/usr/include/sqlite3.h \
94 $(STAGING_DIR)/usr/lib/libsqlite3.{a,so*} \
95 $(STAGING_DIR)/usr/lib/pkgconfig/sqlite3.pc \
96
97 compile: install-dev
98 clean: uninstall-dev