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.

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