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.

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