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.

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