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.

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