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.

131 lines
3.7 KiB

  1. #
  2. # Copyright (C) 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:=unixodbc
  9. PKG_VERSION:=2.3.4
  10. PKG_RELEASE:=4
  11. PKG_SOURCE_URL:=ftp://ftp.unixodbc.org/pub/unixODBC/
  12. PKG_SOURCE:=unixODBC-$(PKG_VERSION).tar.gz
  13. PKG_MD5SUM:=bd25d261ca1808c947cb687e2034be81
  14. PKG_BUILD_DIR:=$(BUILD_DIR)/unixODBC-$(PKG_VERSION)
  15. PKG_MAINTAINER:=Thomas Heil <heil@terminal-consulting.de>
  16. PKG_LICENSE:=prog GPL libs LGPL
  17. include $(INCLUDE_DIR)/package.mk
  18. CONFIGURE_ARGS += \
  19. --disable-gui \
  20. --with-pic \
  21. --enable-drivers \
  22. --includedir=$(STAGING_DIR)/usr/include
  23. define Package/unixodbc/Default
  24. SUBMENU:=database
  25. TITLE:=unixODBC
  26. URL:=http://www.unixodbc.org/
  27. endef
  28. define Package/unixodbc
  29. $(call Package/unixodbc/Default)
  30. TITLE+= (libraries)
  31. SECTION:=libs
  32. CATEGORY:=Libraries
  33. DEPENDS:=+libltdl +libpthread
  34. endef
  35. define Package/unixodbc/description
  36. unixODBC is an Open Source ODBC sub-system and an ODBC SDK for Linux,
  37. Mac OSX, and UNIX.
  38. endef
  39. define Package/unixodbc-tools
  40. $(call Package/unixodbc/Default)
  41. SECTION:=utils
  42. CATEGORY:=Utilities
  43. TITLE+= Tools
  44. DEPENDS:=+unixodbc +libncurses +libreadline
  45. endef
  46. define Package/unixodbc-tools/description
  47. Command Line Tools to help install a driver and work with SQL.
  48. endef
  49. define Package/pgsqlodbc
  50. $(call Package/unixodbc/Default)
  51. SECTION:=libs
  52. CATEGORY:=Libraries
  53. TITLE:=Postgresql driver for ODBC
  54. DEPENDS:=+unixodbc +libpq
  55. endef
  56. define Package/pgsqlodbc/description
  57. Postgresql driver for ODBC.
  58. endef
  59. define Build/Compile
  60. $(MAKE) -C $(PKG_BUILD_DIR) \
  61. DESTDIR="$(PKG_INSTALL_DIR)" \
  62. $(MAKE_FLAGS) \
  63. ARCH="$(ARCH)" \
  64. CC="$(TARGET_CC)"
  65. rm $(PKG_BUILD_DIR)/exe/{odbc_config,odbc-config.o}
  66. $(MAKE) -C $(PKG_BUILD_DIR)/exe \
  67. DESTDIR="$(PKG_INSTALL_DIR)" \
  68. CC="$(HOSTCC)" \
  69. CFLAGS="$(HOST_CFLAGS) -DUSE_UNIXODBC_CONF_H" \
  70. LDFLAGS="$(HOST_LDFLAGS)"
  71. $(MAKE) -C $(PKG_BUILD_DIR) \
  72. DESTDIR="$(PKG_INSTALL_DIR)" \
  73. $(MAKE_FLAGS) \
  74. ARCH="$(ARCH)" \
  75. install -i
  76. endef
  77. define Build/InstallDev
  78. $(INSTALL_DIR) $(1)/host/bin
  79. $(CP) $(PKG_INSTALL_DIR)/usr/bin/odbc_config $(1)/host/bin
  80. $(INSTALL_DIR) $(1)/usr/bin
  81. $(LN) ../../host/bin/odbc_config $(1)/usr/bin
  82. $(INSTALL_DIR) $(1)/usr/include
  83. $(CP) $(PKG_INSTALL_DIR)/$(STAGING_DIR)/usr/include/*.h $(1)/usr/include/
  84. $(INSTALL_DIR) $(1)/usr/lib
  85. $(CP) $(PKG_INSTALL_DIR)/usr/lib/* $(1)/usr/lib/
  86. $(INSTALL_DIR) $(1)/etc
  87. $(CP) $(PKG_INSTALL_DIR)/etc/odbc* $(1)/etc/
  88. $(INSTALL_DIR) $(1)/etc/ODBCDataSources
  89. $(TARGET_CC) $(TARGET_CFLAGS) -E ./files/unixodbc_conf.h | tr '@' '\#' >$(1)/usr/include/unixodbc_conf.h
  90. endef
  91. define Package/unixodbc/install
  92. $(INSTALL_DIR) $(1)/usr/lib
  93. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libodbc[ci]*so* $(1)/usr/lib/
  94. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libodbc.*so* $(1)/usr/lib/
  95. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnn*so* $(1)/usr/lib/
  96. $(INSTALL_DIR) $(1)/etc/init.d
  97. $(INSTALL_BIN) ./files/odbc.init $(1)/etc/init.d/odbc
  98. $(LN) /tmp/etc/odbcinst.ini $(1)/etc/odbcinst.ini
  99. endef
  100. define Package/unixodbc-tools/install
  101. $(INSTALL_DIR) $(1)/usr/bin
  102. $(CP) $(PKG_INSTALL_DIR)/usr/bin/{dltest,isql,iusql,odbcinst,slencheck} $(1)/usr/bin/
  103. endef
  104. define Package/pgsqlodbc/install
  105. $(INSTALL_DIR) $(1)/usr/lib
  106. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libodbcpsql*so* $(1)/usr/lib/
  107. $(INSTALL_DIR) $(1)/etc/odbcinst.ini.d/
  108. echo "[PostgreSQL]" > $(1)/etc/odbcinst.ini.d/pgsqlodbc.ini
  109. echo "Description = unixODBC PostgreSQL driver" >> $(1)/etc/odbcinst.ini.d/pgsqlodbc.ini
  110. echo "Driver = /usr/lib/libodbcpsql.so" >> $(1)/etc/odbcinst.ini.d/pgsqlodbc.ini
  111. endef
  112. $(eval $(call BuildPackage,unixodbc))
  113. $(eval $(call BuildPackage,unixodbc-tools))
  114. $(eval $(call BuildPackage,pgsqlodbc))