1# 
2# Copyright (C) 2006 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: Makefile 12228 2008-08-06 22:43:15Z nbd $
8
9include $(TOPDIR)/rules.mk
10
11PKG_NAME:=sqlite-amalgamation
12PKG_VERSION:=3.6.16
13PKG_RELEASE:=1
14
15PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
16PKG_SOURCE_URL:=http://www.sqlite.org/
17PKG_MD5SUM:=f21ebadcca1e931212000661e64bb20c
18PKG_BUILD_DIR:=$(BUILD_DIR)/sqlite-3.6.16/
19
20PKG_BUILD_DEPENDS:=libncurses libreadline
21
22include $(INCLUDE_DIR)/package.mk
23
24define Package/sqlite3/Default
25  TITLE:=SQLite (v3.x) database engine
26  URL:=http://www.sqlite.org/
27  SUBMENU:=database
28endef
29
30define Package/libsqlite3
31  $(call Package/sqlite3/Default)
32  SECTION:=libs
33  CATEGORY:=Libraries
34  TITLE+= (library)
35endef
36
37define Package/libsqlite3/description
38=
39	SQLite is a small C library that implements a self-contained, embeddable, 
40	zero-configuration SQL database engine.	This package contains the SQLite (v3.x) shared library, used by other programs.
41endef
42
43define Package/sqlite3-cli
44  $(call Package/sqlite3/Default)
45  SECTION:=utils
46  CATEGORY:=Utilities
47  DEPENDS:=+libsqlite3 +libncurses +libreadline
48  TITLE+= (cli)
49endef
50
51define Package/sqlite3-cli/description
52=
53	SQLite is a small C library that implements a self-contained, embeddable, 
54	zero-configuration SQL database engine.	
55	This package contains a terminal-based front-end to the SQLite (v3.x) library 
56	that can evaluate queries interactively and display the results in 
57	multiple formats.
58endef
59
60TARGET_CFLAGS += $(FPIC) \
61	-DSQLITE_ENABLE_UNLOCK_NOTIFY
62
63define Build/Configure
64	$(call Build/Configure/Default, \
65		--enable-shared \
66		--enable-static \
67		--disable-tcl \
68		, \
69		config_BUILD_CC="$(HOSTCC)" \
70		config_BUILD_CFLAGS="-O2" \
71		config_TARGET_CC="$(TARGET_CC)" \
72		config_TARGET_CFLAGS="$(TARGET_CFLAGS)" \
73		config_TARGET_READLINE_INC="-I$(STAGING_DIR)/usr/include" \
74		config_TARGET_READLINE_LIBS="-L$(STAGING_DIR)/usr/lib -lreadline -lncurses" \
75	)
76endef
77
78define Build/Compile
79	$(MAKE) -C $(PKG_BUILD_DIR) \
80		DESTDIR="$(PKG_INSTALL_DIR)" \
81		all install
82endef
83
84define Build/InstallDev
85	mkdir -p $(1)/usr/include
86	$(CP) $(PKG_INSTALL_DIR)/usr/include/sqlite3{,ext}.h $(1)/usr/include/
87	mkdir -p $(1)/usr/lib
88	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libsqlite3.{a,so*} $(1)/usr/lib/
89	mkdir -p $(1)/usr/lib/pkgconfig
90	$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/sqlite3.pc $(1)/usr/lib/pkgconfig/
91endef
92
93define Package/libsqlite3/install
94	$(INSTALL_DIR) $(1)/usr/lib
95	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libsqlite3.so $(1)/usr/lib/
96	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libsqlite3.so.* $(1)/usr/lib/
97endef
98
99define Package/sqlite3-cli/install
100	$(INSTALL_DIR) $(1)/usr/bin
101	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/sqlite3 $(1)/usr/bin/
102endef
103
104$(eval $(call BuildPackage,libsqlite3))
105$(eval $(call BuildPackage,sqlite3-cli))
106