acf2f0dc442005835c7e0e53f6e3b7a123d990ea
[packages.git] / libs / unixodbc / Makefile
1 #
2 # Copyright (C) 2012 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=unixodbc
11 PKG_VERSION:=2.3.1
12 PKG_RELEASE:=1
13
14 PKG_SOURCE_URL:=ftp://ftp.unixodbc.org/pub/unixODBC/
15 PKG_SOURCE:=unixODBC-$(PKG_VERSION).tar.gz
16 PKG_MD5SUM:=86788d4006620fa1f171c13d07fdcaab
17 PKG_BUILD_DIR:=$(BUILD_DIR)/unixODBC-$(PKG_VERSION)
18
19 include $(INCLUDE_DIR)/package.mk
20 CONFIGURE_ARGS += \
21         --disable-gui \
22         --with-pic \
23         --enable-drivers
24
25 define Package/unixodbc/Default
26   SUBMENU:=database
27   TITLE:=unixODBC
28   URL:=http://www.unixodbc.org/
29 endef
30
31 define Package/unixodbc
32   $(call Package/unixodbc/Default)
33   TITLE+= (libraries)
34   SECTION:=libs
35   CATEGORY:=Libraries
36 endef
37
38 define Package/unixodbc/description
39   unixODBC is an Open Source ODBC sub-system and an ODBC SDK for Linux,
40   Mac OSX, and UNIX.
41 endef
42
43 define Package/unixodbc-tools
44   $(call Package/unixodbc/Default)
45   SECTION:=utils
46   CATEGORY:=Utilities
47   TITLE+= Tools
48   DEPENDS:=+unixodbc
49 endef
50
51 define Package/unixodbc-tools/description
52   Command Line Tools to help install a driver and work with SQL.
53 endef
54
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
63 define Package/pgsqlodbc/description
64         Postgresql driver for ODBC.
65 endef
66
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
80 define Build/InstallDev
81         $(INSTALL_DIR) $(1)/usr/bin
82         $(CP) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/
83         $(INSTALL_DIR) $(1)/usr/include
84         $(CP) $(PKG_INSTALL_DIR)/usr/include/*.h $(1)/usr/include/
85         $(INSTALL_DIR) $(1)/usr/lib
86         $(CP) $(PKG_INSTALL_DIR)/usr/lib/* $(1)/usr/lib/
87         $(INSTALL_DIR) $(1)/etc
88         $(CP) $(PKG_INSTALL_DIR)/etc/odbc* $(1)/etc/
89         $(INSTALL_DIR) $(1)/etc/ODBCDataSources
90         $(TARGET_CC) $(TARGET_CFLAGS) -E ./files/unixodbc_conf.h | tr '@' '\#' >$(1)/usr/include/unixodbc_conf.h
91 endef
92
93 define Package/unixodbc/install
94         $(INSTALL_DIR) $(1)/usr/lib
95         $(CP) $(PKG_INSTALL_DIR)/usr/lib/libodbc[ci]*so* $(1)/usr/lib/
96         $(CP) $(PKG_INSTALL_DIR)/usr/lib/libodbc.*so* $(1)/usr/lib/
97         $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnn*so* $(1)/usr/lib/
98         $(INSTALL_DIR) $(1)/etc
99         $(CP) $(PKG_INSTALL_DIR)/etc/odbc* $(1)/etc/
100 endef
101
102 define Package/unixodbc-tools/install
103         $(INSTALL_DIR) $(1)/usr/bin
104         $(CP) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/
105 endef
106
107 define Package/pgsqlodbc/install
108         $(INSTALL_DIR) $(1)/usr/lib
109         $(CP) $(PKG_INSTALL_DIR)/usr/lib/libodbcpsql*so* $(1)/usr/lib/
110 endef
111
112 $(eval $(call BuildPackage,unixodbc))
113 $(eval $(call BuildPackage,unixodbc-tools))
114 $(eval $(call BuildPackage,pgsqlodbc))