You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

116 lines
2.6 KiB

  1. #
  2. # Copyright (C) 2010-2014 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. PKG_NAME:=luasql
  9. PKG_VERSION:=2.1.1
  10. PKG_RELEASE:=1
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  12. PKG_SOURCE_URL:=http://files.luaforge.net/releases/luasql/luasql
  13. PKG_MD5SUM:=63bdd57de4b9d1be336ba112d8cb69eb
  14. PKG_LICENSE:=MIT
  15. PKG_LICENSE_FILE:=docs/us/license.html
  16. PKG_MAINTAINER:=Nicolas Thill <nico@openwrt.org>
  17. PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
  18. include $(INCLUDE_DIR)/package.mk
  19. define Package/luasql/Default
  20. SUBMENU:=Lua
  21. SECTION:=lang
  22. CATEGORY:=Languages
  23. TITLE:=Lua SQL binding
  24. URL:=http://www.keplerproject.org/luasql/
  25. DEPENDS:= +lua
  26. endef
  27. define Package/luasql/Default/description
  28. LuaSQL is a simple interface from Lua to a DBMS.
  29. endef
  30. define Package/luasql-mysql
  31. $(call Package/luasql/Default)
  32. TITLE+= for MySQL
  33. DEPENDS+= +libmysqlclient
  34. VARIANT:=mysql
  35. endef
  36. define Package/luasql-mysql/description
  37. $(call Package/luasql/Default/description)
  38. .
  39. This package contains the MySQL binding.
  40. endef
  41. define Package/luasql-pgsql
  42. $(call Package/luasql/Default)
  43. TITLE+= for PostgreSQL
  44. DEPENDS+= +libpq
  45. VARIANT:=postgres
  46. endef
  47. define Package/luasql-pgsql/description
  48. $(call Package/luasql/Default/description)
  49. .
  50. This package contains the PostgreSQL binding.
  51. endef
  52. define Package/luasql-sqlite3
  53. $(call Package/luasql/Default)
  54. TITLE+= for SQLite 3
  55. DEPENDS+= +libsqlite3
  56. VARIANT:=sqlite3
  57. endef
  58. define Package/luasql-sqlite3/description
  59. $(call Package/luasql/Default/description)
  60. .
  61. This package contains the SQLite 3 binding.
  62. endef
  63. TARGET_CFLAGS += $(FPIC) -std=gnu99
  64. TARGET_CPPFLAGS += -DLUA_USE_LINUX
  65. ifeq ($(BUILD_VARIANT),mysql)
  66. TARGET_CPPFLAGS += -I$(STAGING_DIR)/usr/include/mysql
  67. TARGET_LDFLAGS += -L$(STAGING_DIR)/usr/lib/mysql -lmysqlclient -lz
  68. endif
  69. ifeq ($(BUILD_VARIANT),postgres)
  70. TARGET_LDFLAGS += -lpq
  71. endif
  72. ifeq ($(BUILD_VARIANT),sqlite3)
  73. TARGET_LDFLAGS += -lsqlite3 -lpthread
  74. endif
  75. MAKE_FLAGS += \
  76. T="$(BUILD_VARIANT)" \
  77. DRIVER_INCS="$(TARGET_CPPFLAGS)" \
  78. DRIVER_LIBS="$(TARGET_LDFLAGS)" \
  79. CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
  80. lib
  81. define Package/Install/Default
  82. $(INSTALL_DIR) $(1)/usr/lib/lua/luasql
  83. $(CP) $(PKG_BUILD_DIR)/src/*.so $(1)/usr/lib/lua/luasql/
  84. endef
  85. Package/luasql-mysql/install = $(Package/Install/Default)
  86. Package/luasql-pgsql/install = $(Package/Install/Default)
  87. Package/luasql-sqlite3/install = $(Package/Install/Default)
  88. $(eval $(call BuildPackage,luasql-mysql))
  89. $(eval $(call BuildPackage,luasql-pgsql))
  90. $(eval $(call BuildPackage,luasql-sqlite3))