use Build/Configure/Default macro, Makefile cleanup
[openwrt/svn-archive/archive.git] / libs / sqlite2 / Makefile
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$
8
9 include $(TOPDIR)/rules.mk
10
11 PKG_NAME:=sqlite2
12 PKG_VERSION:=2.8.17
13 PKG_RELEASE:=1
14
15 PKG_SOURCE:=sqlite-$(PKG_VERSION).tar.gz
16 PKG_SOURCE_URL:=http://www.sqlite.org/
17 PKG_MD5SUM:=838dbac20b56d2c4292e98848505a05b
18 PKG_CAT:=zcat
19
20 PKG_BUILD_DIR:=$(BUILD_DIR)/sqlite-$(PKG_VERSION)
21 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
22
23 PKG_BUILDDEP:=libncurses libreadline
24
25 include $(INCLUDE_DIR)/package.mk
26
27 define Package/sqlite2/Default
28 TITLE:=SQLite (v2.x) database engine
29 DESCRIPTION:=\
30 SQLite is a small C library that implements a self-contained, embeddable, \\\
31 zero-configuration SQL database engine.
32 URL:=http://www.sqlite.org/
33 endef
34
35 define Package/libsqlite2
36 $(call Package/sqlite2/Default)
37 SECTION:=libs
38 CATEGORY:=Libraries
39 TITLE+= (library)
40 DESCRIPTION+=\\\
41 \\\
42 This package contains the SQLite (v2.x) shared library, used by other programs.
43 endef
44
45 define Package/sqlite2-cli
46 $(call Package/sqlite2/Default)
47 SECTION:=utils
48 CATEGORY:=Utilities
49 DEPENDS:=+libsqlite2 +libncurses +libreadline
50 TITLE+= (cli)
51 DESCRIPTION+=\\\
52 \\\
53 This package contains a terminal-based front-end to the SQLite (v2.x) library \\\
54 that can evaluate queries interactively and display the results in \\\
55 multiple formats.
56 endef
57
58 define Build/Configure
59 $(call Build/Configure/Default, \
60 --enable-shared \
61 --enable-static \
62 , \
63 config_BUILD_CC="$(HOSTCC)" \
64 config_BUILD_CFLAGS="-O2" \
65 config_TARGET_CC="$(TARGET_CC)" \
66 config_TARGET_CFLAGS="$(TARGET_CFLAGS)" \
67 config_TARGET_READLINE_INC="-I$(STAGING_DIR)/usr/include" \
68 config_TARGET_READLINE_LIBS="-L$(STAGING_DIR)/usr/lib -lreadline -lncurses" \
69 config_TARGET_TCL_INC="-DNO_TCL=1" \
70 )
71 endef
72
73 define Build/Compile
74 $(MAKE) -C $(PKG_BUILD_DIR) \
75 DESTDIR="$(PKG_INSTALL_DIR)" \
76 all install
77 endef
78
79 define Build/InstallDev
80 mkdir -p $(STAGING_DIR)/usr/include
81 $(CP) $(PKG_INSTALL_DIR)/usr/include/sqlite.h $(STAGING_DIR)/usr/include/
82 mkdir -p $(STAGING_DIR)/usr/lib
83 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsqlite.{a,so*} $(STAGING_DIR)/usr/lib/
84 mkdir -p $(STAGING_DIR)/usr/lib/pkgconfig
85 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/sqlite.pc $(STAGING_DIR)/usr/lib/pkgconfig/
86 $(SED) 's,-I$$$${includedir},,g' $(STAGING_DIR)/usr/lib/pkgconfig/sqlite.pc
87 $(SED) 's,-L$$$${libdir},,g' $(STAGING_DIR)/usr/lib/pkgconfig/sqlite.pc
88 endef
89
90 define Build/UninstallDev
91 rm -rf $(STAGING_DIR)/usr/include/sqlite.h \
92 $(STAGING_DIR)/usr/lib/libsqlite.{a,so*} \
93 $(STAGING_DIR)/usr/lib/pkgconfig/sqlite.pc
94 endef
95
96 define Package/libsqlite2/install
97 install -d -m0755 $(1)/usr/lib
98 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsqlite.so.* $(1)/usr/lib/
99 endef
100
101 define Package/sqlite2-cli/install
102 install -d -m0755 $(1)/usr/bin
103 $(CP) $(PKG_INSTALL_DIR)/usr/bin/sqlite $(1)/usr/bin/
104 endef
105
106 $(eval $(call BuildPackage,libsqlite2))
107 $(eval $(call BuildPackage,sqlite2-cli))