aboutsummaryrefslogtreecommitdiff
path: root/libs/unixodbc/Makefile
blob: 87e94f6398d8639f000b7d28c9b44bf7b77eab0d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
#
# Copyright (C) 2014 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=unixodbc
PKG_VERSION:=2.3.9
PKG_RELEASE:=7

PKG_SOURCE:=unixODBC-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://www.unixodbc.org
PKG_HASH:=52833eac3d681c8b0c9a5a65f2ebd745b3a964f208fc748f977e44015a31b207

PKG_MAINTAINER:=Thomas Heil <heil@terminal-consulting.de>
PKG_LICENSE:=LGPL-2.1-or-later GPL-2.0-or-later
PKG_LICENSE_FILES:=COPYING exe/COPYING
PKG_CPE_ID:=cpe:/a:unixodbc:unixodbc

PKG_BUILD_DIR:=$(BUILD_DIR)/unixODBC-$(PKG_VERSION)
HOST_BUILD_DIR:=$(BUILD_DIR)/host/unixODBC-$(PKG_VERSION)

PKG_BUILD_PARALLEL:=1
PKG_FIXUP:=autoreconf
PKG_INSTALL:=1

HOST_BUILD_DEPENDS:=unixodbc
HOST_BUILD_PARALLEL:=1

# if your other package depends on unixodbc and needs
# odbc_config, add to your other Makefile
#  PKG_BUILD_DEPENDS:=unixodbc/host

include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/host-build.mk

CONFIGURE_ARGS += \
	--disable-gui \
	--with-pic \
	--enable-drivers

define Package/unixodbc/Default
  SUBMENU:=Database
  TITLE:=unixODBC
  URL:=https://www.unixodbc.org
endef

define Package/unixodbc/Default/description
unixODBC is an Open Source ODBC sub-system and an ODBC SDK for Linux,
Mac OSX, and UNIX.
endef

define Package/libodbc
$(call Package/unixodbc/Default)
  TITLE+= Driver Manager library
  SECTION:=libs
  CATEGORY:=Libraries
  DEPENDS:=+libltdl +libpthread
  ABI_VERSION:=2
endef

define Package/libodbc/description
$(call Package/unixodbc/Default/description)

This package provides the unixODBC Driver Manager library.
endef

define Package/libodbccr
$(call Package/unixodbc/Default)
  TITLE+= Cursor library
  SECTION:=libs
  CATEGORY:=Libraries
  DEPENDS:=+libodbc +libltdl +libpthread
  ABI_VERSION:=2
endef

define Package/libodbccr/description
$(call Package/unixodbc/Default/description)

This package provides the unixODBC Cursor library.
endef

define Package/libodbcinst
$(call Package/unixodbc/Default)
  TITLE+= Configuration library
  SECTION:=libs
  CATEGORY:=Libraries
  DEPENDS:=+libltdl +libpthread
  ABI_VERSION:=2
endef

define Package/libodbcinst/description
$(call Package/unixodbc/Default/description)

This package provides the unixODBC Configuration library.
endef

define Package/unixodbc
$(call Package/unixodbc/Default)
  TITLE+= (libraries)
  SECTION:=libs
  CATEGORY:=Libraries
  DEPENDS:=+libodbc +libodbccr +libodbcinst
endef

define Package/unixodbc/description
$(call Package/unixodbc/Default/description)

This package installs the unixODBC Driver Manager, Cursor, and
Configuration libraries. This package is provided for backwards
compatibility; these libraries are available in separate packages.
endef

define Package/unixodbc-tools
$(call Package/unixodbc/Default)
  SECTION:=utils
  CATEGORY:=Utilities
  TITLE+= Tools
  DEPENDS:=+libodbc +libodbcinst +libltdl +libreadline
endef

define Package/unixodbc-tools/description
$(call Package/unixodbc/Default/description)

This package provides command-line tools to help install a driver and
work with SQL.
endef

define Package/pgsqlodbc
$(call Package/unixodbc/Default)
  SECTION:=libs
  CATEGORY:=Libraries
  TITLE:=PostgreSQL driver for ODBC
  DEPENDS:=+libodbc +libpq +libltdl +libpthread
  ABI_VERSION:=2
endef

define Package/pgsqlodbc/description
$(call Package/unixodbc/Default/description)

This package provides the PostgreSQL driver for ODBC.
endef

define Build/InstallDev
	$(INSTALL_DIR) $(1)/usr/include
	$(CP) $(PKG_INSTALL_DIR)/usr/include/*.h $(1)/usr/include/
	# Save autoconf config.h file for host build
	# copy target autoconf config.h and unixodbc_conf.h file for host build
	$(INSTALL_DIR) $(1)/usr/include/unixodbc
	$(CP) $(PKG_BUILD_DIR)/config.h $(1)/usr/include/unixodbc/
	$(CP) $(PKG_BUILD_DIR)/unixodbc_conf.h $(1)/usr/include/unixodbc/
	$(INSTALL_DIR) $(1)/usr/lib
	$(CP) $(PKG_INSTALL_DIR)/usr/lib/* $(1)/usr/lib/
	$(INSTALL_DIR) $(1)/etc
	$(CP) $(PKG_INSTALL_DIR)/etc/odbc* $(1)/etc/
	$(INSTALL_DIR) $(1)/etc/ODBCDataSources
endef

define Package/libodbc/install
	$(INSTALL_DIR) $(1)/usr/lib
	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libodbc.so* $(1)/usr/lib/
	$(INSTALL_DIR) $(1)/etc/init.d
	$(INSTALL_BIN) ./files/odbc.init $(1)/etc/init.d/odbc
	$(LN) /tmp/etc/odbcinst.ini $(1)/etc/odbcinst.ini
endef

define Package/libodbccr/install
	$(INSTALL_DIR) $(1)/usr/lib
	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libodbccr.so* $(1)/usr/lib/
endef

define Package/libodbcinst/install
	$(INSTALL_DIR) $(1)/usr/lib
	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libodbcinst.so* $(1)/usr/lib/
endef

Package/unixodbc/install:=:

define Package/unixodbc-tools/install
	$(INSTALL_DIR) $(1)/usr/bin
	$(CP) $(PKG_INSTALL_DIR)/usr/bin/{dltest,isql,iusql,odbcinst,slencheck} $(1)/usr/bin/
endef

define Package/pgsqlodbc/install
	$(INSTALL_DIR) $(1)/usr/lib
	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libodbcpsql.so* $(1)/usr/lib/
	$(INSTALL_DIR) $(1)/etc/odbcinst.ini.d/
	$(INSTALL_DATA) ./files/pgsqlodbc.ini $(1)/etc/odbcinst.ini.d/
endef

define Host/Configure
	$(call Host/Configure/Default)
	$(CP) $(STAGING_DIR)/usr/include/unixodbc/config.h $(HOST_BUILD_DIR)
	$(CP) $(STAGING_DIR)/usr/include/unixodbc/unixodbc_conf.h $(HOST_BUILD_DIR)
	$(SED) 's!^#define INCLUDE_PREFIX ".*"!#define INCLUDE_PREFIX "$(STAGING_DIR)/usr/include"!' \
		-e 's!^#define LIB_PREFIX ".*"!#define LIB_PREFIX "$(STAGING_DIR)/usr/lib"!' \
		$(HOST_BUILD_DIR)/config.h \
		$(HOST_BUILD_DIR)/unixodbc_conf.h
endef

define Host/Compile
	$(call Host/Compile/Default,-C $(HOST_BUILD_DIR)/exe odbc_config)
endef

define Host/Install
	$(INSTALL_DIR) $(STAGING_DIR)/host/bin
	$(INSTALL_BIN) $(HOST_BUILD_DIR)/exe/odbc_config $(STAGING_DIR)/host/bin/
endef

$(eval $(call BuildPackage,libodbc))
$(eval $(call BuildPackage,libodbccr))
$(eval $(call BuildPackage,libodbcinst))
$(eval $(call BuildPackage,unixodbc))
$(eval $(call BuildPackage,unixodbc-tools))
$(eval $(call BuildPackage,pgsqlodbc))
$(eval $(call HostBuild))