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.

161 lines
4.5 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. # Save autoconf config.h file for host build
  83. # copy target autoconf config.h and unixodbc_conf.h file for host build
  84. $(INSTALL_DIR) $(1)/tmp/unixodbc
  85. $(CP) $(PKG_BUILD_DIR)/config.h $(1)/tmp/unixodbc/
  86. $(CP) $(PKG_BUILD_DIR)/unixodbc_conf.h $(1)/tmp/unixodbc/
  87. $(INSTALL_DIR) $(1)/usr/lib
  88. $(CP) $(PKG_INSTALL_DIR)/usr/lib/* $(1)/usr/lib/
  89. $(INSTALL_DIR) $(1)/etc
  90. $(CP) $(PKG_INSTALL_DIR)/etc/odbc* $(1)/etc/
  91. $(INSTALL_DIR) $(1)/etc/ODBCDataSources
  92. $(TARGET_CC) $(TARGET_CFLAGS) -E ./files/unixodbc_conf.h | tr '@' '\#' >$(1)/usr/include/unixodbc_conf.h
  93. endef
  94. define Package/unixodbc/install
  95. $(INSTALL_DIR) $(1)/usr/lib
  96. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libodbc[ci]*so* $(1)/usr/lib/
  97. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libodbc.*so* $(1)/usr/lib/
  98. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnn*so* $(1)/usr/lib/
  99. $(INSTALL_DIR) $(1)/etc/init.d
  100. $(INSTALL_BIN) ./files/odbc.init $(1)/etc/init.d/odbc
  101. $(LN) /tmp/etc/odbcinst.ini $(1)/etc/odbcinst.ini
  102. endef
  103. define Package/unixodbc-tools/install
  104. $(INSTALL_DIR) $(1)/usr/bin
  105. $(CP) $(PKG_INSTALL_DIR)/usr/bin/{dltest,isql,iusql,odbcinst,slencheck} $(1)/usr/bin/
  106. endef
  107. define Package/pgsqlodbc/install
  108. $(INSTALL_DIR) $(1)/usr/lib
  109. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libodbcpsql*so* $(1)/usr/lib/
  110. $(INSTALL_DIR) $(1)/etc/odbcinst.ini.d/
  111. echo "[PostgreSQL]" > $(1)/etc/odbcinst.ini.d/pgsqlodbc.ini
  112. echo "Description = unixODBC PostgreSQL driver" >> $(1)/etc/odbcinst.ini.d/pgsqlodbc.ini
  113. echo "Driver = /usr/lib/libodbcpsql.so" >> $(1)/etc/odbcinst.ini.d/pgsqlodbc.ini
  114. endef
  115. define Host/Configure
  116. $(call Host/Configure/Default)
  117. cp $(STAGING_DIR)/tmp/unixodbc/config.h $(HOST_BUILD_DIR)
  118. sed -i -e 's!\(LIB_PREFIX \).*$$$$!\1"$(STAGING_DIR)/usr/lib"!' $(HOST_BUILD_DIR)/config.h
  119. cp $(STAGING_DIR)/tmp/unixodbc/unixodbc_conf.h $(HOST_BUILD_DIR)
  120. endef
  121. define Host/Compile
  122. $(MAKE) -C $(HOST_BUILD_DIR)/exe \
  123. DESTDIR="$(HOST_INSTALL_DIR)" \
  124. CC="$(HOSTCC)" \
  125. CFLAGS="$(HOST_CFLAGS) -DUSE_UNIXODBC_CONF_H" \
  126. LDFLAGS="$(HOST_LDFLAGS)" \
  127. odbc_config
  128. endef
  129. define Host/Install
  130. $(INSTALL_DIR) $(STAGING_DIR_HOST)/bin
  131. $(CP) $(HOST_BUILD_DIR)/exe/odbc_config $(STAGING_DIR_HOST)/bin
  132. endef
  133. $(eval $(call BuildPackage,unixodbc))
  134. $(eval $(call BuildPackage,unixodbc-tools))
  135. $(eval $(call BuildPackage,pgsqlodbc))
  136. $(eval $(call HostBuild))