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.

112 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.4.0
  10. PKG_RELEASE:=2
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  12. PKG_SOURCE_URL:=https://codeload.github.com/keplerproject/luasql/tar.gz/v$(PKG_VERSION)?
  13. PKG_HASH:=db2458a8c8c5f3bc717e4030fe2878f1ad8d71e437ec6149c381eebad5d525c5
  14. PKG_MAINTAINER:=
  15. PKG_LICENSE:=MIT
  16. PKG_LICENSE_FILES:=docs/us/license.html
  17. include $(INCLUDE_DIR)/package.mk
  18. define Package/luasql/Default
  19. SUBMENU:=Lua
  20. SECTION:=lang
  21. CATEGORY:=Languages
  22. TITLE:=Lua SQL binding
  23. URL:=https://keplerproject.github.io/luasql/
  24. DEPENDS:= +lua
  25. endef
  26. define Package/luasql/Default/description
  27. LuaSQL is a simple interface from Lua to a DBMS.
  28. endef
  29. define Package/luasql-mysql
  30. $(call Package/luasql/Default)
  31. TITLE+= for MySQL
  32. DEPENDS+= +libmysqlclient
  33. VARIANT:=mysql
  34. endef
  35. define Package/luasql-mysql/description
  36. $(call Package/luasql/Default/description)
  37. .
  38. This package contains the MySQL binding.
  39. endef
  40. define Package/luasql-pgsql
  41. $(call Package/luasql/Default)
  42. TITLE+= for PostgreSQL
  43. DEPENDS+= +libpq
  44. VARIANT:=postgres
  45. endef
  46. define Package/luasql-pgsql/description
  47. $(call Package/luasql/Default/description)
  48. .
  49. This package contains the PostgreSQL binding.
  50. endef
  51. define Package/luasql-sqlite3
  52. $(call Package/luasql/Default)
  53. TITLE+= for SQLite 3
  54. DEPENDS+= +libsqlite3
  55. VARIANT:=sqlite3
  56. endef
  57. define Package/luasql-sqlite3/description
  58. $(call Package/luasql/Default/description)
  59. .
  60. This package contains the SQLite 3 binding.
  61. endef
  62. TARGET_CFLAGS += $(FPIC) -std=gnu99
  63. TARGET_CPPFLAGS += -DLUA_USE_LINUX
  64. ifeq ($(BUILD_VARIANT),mysql)
  65. MAKE_FLAGS += DRIVER_INCS_mysql='-I$(STAGING_DIR)/usr/include/mysql' \
  66. DRIVER_LIBS_mysql='$(TARGET_LDFLAGS) -L$(STAGING_DIR)/usr/lib/mysql -lmysqlclient -lz'
  67. endif
  68. ifeq ($(BUILD_VARIANT),postgres)
  69. MAKE_FLAGS += DRIVER_LIBS_postgres='$(TARGET_LDFLAGS) -lpq'
  70. endif
  71. ifeq ($(BUILD_VARIANT),sqlite3)
  72. MAKE_FLAGS += DRIVER_LIBS_sqlite='$(TARGET_LDFLAGS) -lsqlite3 -lpthread'
  73. endif
  74. MAKE_FLAGS += \
  75. LIB_OPTION="-shared" \
  76. CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
  77. $(BUILD_VARIANT)
  78. define Package/Install/Default
  79. $(INSTALL_DIR) $(1)/usr/lib/lua/luasql
  80. $(CP) $(PKG_BUILD_DIR)/src/*.so $(1)/usr/lib/lua/luasql/
  81. endef
  82. Package/luasql-mysql/install = $(Package/Install/Default)
  83. Package/luasql-pgsql/install = $(Package/Install/Default)
  84. Package/luasql-sqlite3/install = $(Package/Install/Default)
  85. $(eval $(call BuildPackage,luasql-mysql))
  86. $(eval $(call BuildPackage,luasql-pgsql))
  87. $(eval $(call BuildPackage,luasql-sqlite3))