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.

114 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:=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. 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. DRIVER_INCS="$(TARGET_CPPFLAGS)" \
  77. DRIVER_LIBS="$(TARGET_LDFLAGS)" \
  78. CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
  79. $(BUILD_VARIANT)
  80. define Package/Install/Default
  81. $(INSTALL_DIR) $(1)/usr/lib/lua/luasql
  82. $(CP) $(PKG_BUILD_DIR)/src/*.so $(1)/usr/lib/lua/luasql/
  83. endef
  84. Package/luasql-mysql/install = $(Package/Install/Default)
  85. Package/luasql-pgsql/install = $(Package/Install/Default)
  86. Package/luasql-sqlite3/install = $(Package/Install/Default)
  87. $(eval $(call BuildPackage,luasql-mysql))
  88. $(eval $(call BuildPackage,luasql-pgsql))
  89. $(eval $(call BuildPackage,luasql-sqlite3))