Makefile 2.7 KB

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