ettercap: Fix parallel build
[openwrt/svn-archive/archive.git] / lang / luasql / Makefile
1 #
2 # Copyright (C) 2010 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=luasql
11 PKG_VERSION:=2.1.1
12 PKG_RELEASE:=1
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15 PKG_SOURCE_URL:=http://luaforge.net/frs/download.php/2686/
16 PKG_MD5SUM:=63bdd57de4b9d1be336ba112d8cb69eb
17
18 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
19
20 include $(INCLUDE_DIR)/package.mk
21
22 define Package/luasql/Default
23 SUBMENU:=Lua
24 SECTION:=lang
25 CATEGORY:=Languages
26 TITLE:=Lua SQL binding
27 URL:=http://www.keplerproject.org/luasql/
28 DEPENDS:= +lua
29 endef
30
31 define Package/luasql/Default/description
32 LuaSQL is a simple interface from Lua to a DBMS.
33 endef
34
35
36 define Package/luasql-mysql
37 $(call Package/luasql/Default)
38 TITLE+= for MySQL
39 DEPENDS+= +libmysqlclient
40 VARIANT:=mysql
41 endef
42
43 define Package/luasql-mysql/description
44 $(call Package/luasql/Default/description)
45 .
46 This package contains the MySQL binding.
47 endef
48
49
50 define Package/luasql-pgsql
51 $(call Package/luasql/Default)
52 TITLE+= for PostgreSQL
53 DEPENDS+= +libpq
54 VARIANT:=postgres
55 endef
56
57 define Package/luasql-pgsql/description
58 $(call Package/luasql/Default/description)
59 .
60 This package contains the PostgreSQL binding.
61 endef
62
63
64 define Package/luasql-sqlite3
65 $(call Package/luasql/Default)
66 TITLE+= for SQLite 3
67 DEPENDS+= +libsqlite3
68 VARIANT:=sqlite3
69 endef
70
71 define Package/luasql-sqlite3/description
72 $(call Package/luasql/Default/description)
73 .
74 This package contains the SQLite 3 binding.
75 endef
76
77
78 TARGET_CFLAGS += $(FPIC) -std=gnu99
79 TARGET_CPPFLAGS += -DLUA_USE_LINUX
80
81 ifeq ($(BUILD_VARIANT),mysql)
82 TARGET_CPPFLAGS += -I$(STAGING_DIR)/usr/include/mysql
83 TARGET_LDFLAGS += -L$(STAGING_DIR)/usr/lib/mysql -lmysqlclient -lz
84 endif
85
86 ifeq ($(BUILD_VARIANT),postgres)
87 TARGET_LDFLAGS += -lpq
88 endif
89
90 ifeq ($(BUILD_VARIANT),sqlite3)
91 TARGET_LDFLAGS += -lsqlite3 -lpthread
92 endif
93
94 define Build/Compile
95 $(MAKE) -C $(PKG_BUILD_DIR) \
96 T="$(BUILD_VARIANT)" \
97 PREFIX="$(STAGING_DIR)/usr" \
98 LUA_LIBDIR="$(STAGING_DIR)/usr/lib/lua" \
99 DRIVER_INCS="$(TARGET_CPPFLAGS)" \
100 DRIVER_LIBS="$(TARGET_LDFLAGS)" \
101 CC="$(TARGET_CROSS)gcc" \
102 CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
103 lib
104 $(MAKE) -C $(PKG_BUILD_DIR) \
105 T="$(BUILD_VARIANT)" \
106 LUA_LIBDIR="$(PKG_INSTALL_DIR)/usr/lib/lua" \
107 install
108 endef
109
110 define Build/Install/Default
111 $(INSTALL_DIR) $(1)/usr/lib/lua/luasql
112 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lua/luasql/*.so $(1)/usr/lib/lua/luasql/
113 endef
114
115 Package/luasql-mysql/install = $(Build/Install/Default)
116 Package/luasql-pgsql/install = $(Build/Install/Default)
117 Package/luasql-sqlite3/install = $(Build/Install/Default)
118
119 $(eval $(call BuildPackage,luasql-mysql))
120 $(eval $(call BuildPackage,luasql-pgsql))
121 $(eval $(call BuildPackage,luasql-sqlite3))