port sqlite2 to buildroot-ng
[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_BUILD_DIR:=$(BUILD_DIR)/sqlite-$(PKG_VERSION)
16 PKG_SOURCE:=sqlite-$(PKG_VERSION).tar.gz
17 PKG_SOURCE_URL:=http://www.sqlite.org/
18 PKG_MD5SUM:=838dbac20b56d2c4292e98848505a05b
19 PKG_CAT:=zcat
20
21 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
22 PKG_BUILDDEP:=ncurses readline
23
24 include $(INCLUDE_DIR)/package.mk
25
26 define Package/libsqlite2
27 SECTION:=libs
28 CATEGORY:=Libraries
29 TITLE:=Self-contained SQL database engine
30 DESCRIPTION:=Self-contained, embeddable, zero-configuration SQL database engine.\\\
31 SQLite is a small C library that implements a self-contained, embeddable, \\\
32 zero-configuration SQL database engine.\\\
33 \\\
34 This package contains the shared library, needed by other programs.
35 URL:=http://www.sqlite.org/
36 endef
37
38 define Package/sqlite2-cli
39 SECTION:=libs
40 CATEGORY:=Libraries
41 DEPENDS:=libsqlite2 +libncurses +libreadline
42 TITLE:=Command line interface for SQLite
43 DESCRIPTION:=Command line interface for SQLite.\\\
44 SQLite is a small C library that implements a self-contained, embeddable, \\\
45 zero-configuration SQL database engine.\\\
46 \\\
47 This package contains a terminal-based front-end to the SQLite library \\\
48 that can evaluate queries interactively and display the results in \\\
49 multiple formats.
50 URL:=http://www.sqlite.org/
51 endef
52
53 define Build/Configure
54 (cd $(PKG_BUILD_DIR); rm -f config.cache; \
55 $(TARGET_CONFIGURE_OPTS) \
56 CFLAGS="$(TARGET_CFLAGS)" \
57 CPPFLAGS="-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include" \
58 LDFLAGS="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib" \
59 config_BUILD_CC="$(HOSTCC)" \
60 config_BUILD_CFLAGS="-O2" \
61 config_TARGET_CC="$(TARGET_CC)" \
62 config_TARGET_CFLAGS="$(TARGET_CFLAGS)" \
63 config_TARGET_READLINE_INC="-I$(STAGING_DIR)/usr/include" \
64 config_TARGET_READLINE_LIBS="-L$(STAGING_DIR)/usr/lib -lreadline -lncurses" \
65 config_TARGET_TCL_INC="-DNO_TCL=1" \
66 ./configure \
67 --target=$(GNU_TARGET_NAME) \
68 --host=$(GNU_TARGET_NAME) \
69 --build=$(GNU_HOST_NAME) \
70 --program-prefix="" \
71 --program-suffix="" \
72 --prefix=/usr \
73 --exec-prefix=/usr \
74 --bindir=/usr/bin \
75 --datadir=/usr/share \
76 --includedir=/usr/include \
77 --infodir=/usr/share/info \
78 --libdir=/usr/lib \
79 --libexecdir=/usr/lib \
80 --localstatedir=/var \
81 --mandir=/usr/share/man \
82 --sbindir=/usr/sbin \
83 --sysconfdir=/etc \
84 $(DISABLE_LARGEFILE) \
85 --enable-shared \
86 --enable-static \
87 );
88 endef
89
90 define Build/Compile
91 rm -rf $(PKG_INSTALL_DIR)
92 mkdir -p $(PKG_INSTALL_DIR)
93 $(MAKE) -C $(PKG_BUILD_DIR) \
94 DESTDIR="$(PKG_INSTALL_DIR)" \
95 all install
96 endef
97
98 define Package/libsqlite2/install
99 install -d -m0755 $(1)/usr/lib
100 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsqlite.so.* $(1)/usr/lib/
101 endef
102
103 define Package/sqlite2-cli/install
104 install -d -m0755 $(1)/usr/bin
105 $(CP) $(PKG_INSTALL_DIR)/usr/bin/sqlite $(1)/usr/bin/
106 endef
107
108 define Build/InstallDev
109 mkdir -p $(STAGING_DIR)/usr/include
110 $(CP) $(PKG_INSTALL_DIR)/usr/include/sqlite.h $(STAGING_DIR)/usr/include/
111 mkdir -p $(STAGING_DIR)/usr/lib
112 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsqlite.{a,so*} $(STAGING_DIR)/usr/lib/
113 mkdir -p $(STAGING_DIR)/usr/lib/pkgconfig
114 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/sqlite.pc $(STAGING_DIR)/usr/lib/pkgconfig/
115 endef
116
117 define Build/UninstallDev
118 rm -rf \
119 $(STAGING_DIR)/usr/include/sqlite.h \
120 $(STAGING_DIR)/usr/lib/libsqlite.{a,so*} \
121 $(STAGING_DIR)/usr/lib/pkgconfig/sqlite.pc
122 endef
123
124 $(eval $(call BuildPackage,libsqlite2))
125 $(eval $(call BuildPackage,sqlite2-cli))