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.7 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:=1
  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_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
  15. PKG_MAINTAINER:=
  16. PKG_LICENSE:=MIT
  17. PKG_LICENSE_FILES:=docs/us/license.html
  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:=https://keplerproject.github.io/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. MAKE_FLAGS += DRIVER_INCS_mysql='-I$(STAGING_DIR)/usr/include/mysql' \
  67. DRIVER_LIBS_mysql='$(TARGET_LDFLAGS) -L$(STAGING_DIR)/usr/lib/mysql -lmysqlclient -lz'
  68. endif
  69. ifeq ($(BUILD_VARIANT),postgres)
  70. MAKE_FLAGS += DRIVER_LIBS_postgres='$(TARGET_LDFLAGS) -lpq'
  71. endif
  72. ifeq ($(BUILD_VARIANT),sqlite3)
  73. MAKE_FLAGS += DRIVER_LIBS_sqlite='$(TARGET_LDFLAGS) -lsqlite3 -lpthread'
  74. endif
  75. MAKE_FLAGS += \
  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))