PORT.OpenLink 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489
  1. #!/bin/sh
  2. #
  3. # PORT.OpenLink
  4. #
  5. # Script to port iODBC to various platforms and ABIs
  6. #
  7. # The iODBC driver manager.
  8. #
  9. # Copyright (C) 1996-2021 OpenLink Software <[email protected]>
  10. # All Rights Reserved.
  11. #
  12. # This software is released under the terms of either of the following
  13. # licenses:
  14. #
  15. # - GNU Library General Public License (see LICENSE.LGPL)
  16. # - The BSD License (see LICENSE.BSD).
  17. #
  18. # Note that the only valid version of the LGPL license as far as this
  19. # project is concerned is the original GNU Library General Public License
  20. # Version 2, dated June 1991.
  21. #
  22. # While not mandated by the BSD license, any patches you make to the
  23. # iODBC source code may be contributed back into the iODBC project
  24. # at your discretion. Contributions will benefit the Open Source and
  25. # Data Access community as a whole. Submissions may be made at:
  26. #
  27. # http://www.iodbc.org
  28. #
  29. #
  30. # GNU Library Generic Public License Version 2
  31. # ============================================
  32. # This library is free software; you can redistribute it and/or
  33. # modify it under the terms of the GNU Library General Public
  34. # License as published by the Free Software Foundation; only
  35. # Version 2 of the License dated June 1991.
  36. #
  37. # This library is distributed in the hope that it will be useful,
  38. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  39. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  40. # Library General Public License for more details.
  41. #
  42. # You should have received a copy of the GNU Library General Public
  43. # License along with this library; if not, write to the Free
  44. # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  45. #
  46. #
  47. # The BSD License
  48. # ===============
  49. # Redistribution and use in source and binary forms, with or without
  50. # modification, are permitted provided that the following conditions
  51. # are met:
  52. #
  53. # 1. Redistributions of source code must retain the above copyright
  54. # notice, this list of conditions and the following disclaimer.
  55. # 2. Redistributions in binary form must reproduce the above copyright
  56. # notice, this list of conditions and the following disclaimer in
  57. # the documentation and/or other materials provided with the
  58. # distribution.
  59. # 3. Neither the name of OpenLink Software Inc. nor the names of its
  60. # contributors may be used to endorse or promote products derived
  61. # from this software without specific prior written permission.
  62. #
  63. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  64. # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  65. # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  66. # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR
  67. # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  68. # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  69. # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  70. # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  71. # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  72. # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  73. # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  74. #
  75. #
  76. # Defaults
  77. #
  78. TOP=`pwd`
  79. OS=`admin/config.guess`
  80. PREFIX=/usr/local/iODBC
  81. CC=${CC:-cc}
  82. CFLAGS=${CFLAGS:-"-O"}
  83. LDFLAGS=${LDFLAGS:-""}
  84. CONFLAGS=${CONFLAGS:-"--disable-gui --enable-maintainer-mode"}
  85. MAKE=${MAKE:-make}
  86. BUILD=run_make
  87. export TOP CC CFLAGS LDFLAGS OS PREFIX CONFLAGS BUILD MAKE
  88. #
  89. # Parse arguments
  90. #
  91. ARG=${1:-usage}
  92. case $ARG in
  93. -[Cc]|configure)
  94. BUILD=run_config;;
  95. -[Mm]|make)
  96. BUILD=run_make;;
  97. *)
  98. echo "PORT script to build OpenLink type installation packages"
  99. echo "in $PREFIX."
  100. echo ""
  101. echo "Usage: $0 [ -c | -m]"
  102. echo ""
  103. echo " -c run configure"
  104. echo " -m run make [clean|install]"
  105. exit 1
  106. ;;
  107. esac
  108. #
  109. # Optional argument for make clean
  110. #
  111. shift
  112. MAKERULE=${*:-""}
  113. export MAKERULE
  114. #
  115. # Configure the package
  116. #
  117. run_config()
  118. {
  119. MODE=${1:-"default"}
  120. export MODE
  121. case $MODE in
  122. o32) # Irix
  123. $TOP/admin/mkinstalldirs build-o32
  124. cd build-o32
  125. ../configure --prefix=$PREFIX $CONFLAGS --bindir='${prefix}/bino32' --libdir='${prefix}/libo32'
  126. cd ..
  127. ;;
  128. 32)
  129. $TOP/admin/mkinstalldirs build-32
  130. cd build-32
  131. ../configure --prefix=$PREFIX $CONFLAGS --bindir='${prefix}/bin32' --libdir='${prefix}/lib32'
  132. cd ..
  133. ;;
  134. 64)
  135. $TOP/admin/mkinstalldirs build-64
  136. cd build-64
  137. ../configure --prefix=$PREFIX $CONFLAGS --bindir='${prefix}/bin64' --libdir='${prefix}/lib64'
  138. cd ..
  139. ;;
  140. universal)
  141. $TOP/admin/mkinstalldirs build-universal
  142. cd build-universal
  143. ../configure --prefix=$PREFIX $CONFLAGS
  144. cd ..
  145. ;;
  146. cur)
  147. ./configure --prefix=$PREFIX $CONFLAGS
  148. ;;
  149. *)
  150. $TOP/admin/mkinstalldirs build
  151. cd build
  152. ../configure --prefix=$PREFIX $CONFLAGS
  153. cd ..
  154. ;;
  155. esac
  156. }
  157. #
  158. # Make the package
  159. #
  160. run_make()
  161. {
  162. MODE=${1:-"default"}
  163. export MODE
  164. case $MODE in
  165. o32)
  166. cd build-o32
  167. $MAKE $MAKERULE
  168. cd ..
  169. ;;
  170. 32)
  171. cd build-32
  172. $MAKE $MAKERULE
  173. cd ..
  174. ;;
  175. 64)
  176. cd build-64
  177. $MAKE $MAKERULE
  178. cd ..
  179. ;;
  180. universal)
  181. cd build-universal
  182. $MAKE $MAKERULE
  183. cd ..
  184. ;;
  185. cur)
  186. $MAKE $MAKERULE
  187. ;;
  188. *)
  189. cd build
  190. $MAKE $MAKERULE
  191. cd ..
  192. ;;
  193. esac
  194. }
  195. #
  196. # Main
  197. #
  198. case $OS in
  199. powerpc-ibm-aix4*)
  200. CC=cc_r7
  201. CFLAGS="-O -q32"
  202. LDFLAGS="-brtl"
  203. OBJECT_MODE=64
  204. export CC CFLAGS LDFLAGS OBJECT_MODE
  205. $BUILD 32
  206. CC=cc_r7
  207. CFLAGS="-O -q64"
  208. LDFLAGS="-brtl"
  209. OBJECT_MODE=64
  210. export CC CFLAGS LDFLAGS OBJECT_MODE
  211. $BUILD 64
  212. ;;
  213. hppa2.0w-hp-hpux11*)
  214. CFLAGS="-O -Ae +DA1.1"
  215. export CFLAGS
  216. $BUILD 32
  217. CFLAGS="-O -Ae +DA2.0W"
  218. export CFLAGS
  219. $BUILD 64
  220. ;;
  221. sparc-sun-solaris2.*)
  222. CFLAGS="-O"
  223. export CFLAGS
  224. $BUILD 32
  225. CFLAGS="-O -xtarget=ultra -xarch=v9"
  226. export CFLAGS
  227. $BUILD 64
  228. ;;
  229. i[3456]86-*-solaris2.*)
  230. CFLAGS="-O -xtarget=opteron"
  231. export CFLAGS
  232. $BUILD 32
  233. CFLAGS="-O -xtarget=opteron -xarch=amd64"
  234. export CFLAGS
  235. $BUILD 64
  236. ;;
  237. i[3456]86-pc-linux-*)
  238. CFLAGS="-O3"
  239. CONFLAGS="--enable-gui --enable-maintainer-mode"
  240. export CFLAGS CONFLAGS
  241. $BUILD cur
  242. ;;
  243. x86_64-suse-linux)
  244. CFLAGS="-O3"
  245. CONFLAGS="--enable-gui --enable-maintainer-mode"
  246. export CFLAGS CONFLAGS
  247. $BUILD
  248. ;;
  249. x86_64-*-linux-gnu)
  250. CONFLAGS="--enable-gui --enable-maintainer-mode --with-pic"
  251. CFLAGS="-O3 -m32"
  252. export CFLAGS CONFLAGS
  253. $BUILD 32
  254. CFLAGS="-O3 -m64"
  255. export CFLAGS CONFLAGS
  256. $BUILD 64
  257. ;;
  258. aarch64-apple-darwin20*)
  259. PREFIX=/usr/local/iODBC.universal
  260. CONFLAGS="--disable-shared --with-pic --disable-dependency-tracking"
  261. CFLAGS="-O -mmacosx-version-min=10.9 -arch arm64 -arch x86_64"
  262. export PREFIX CONFLAGS CFLAGS
  263. $BUILD universal
  264. ;;
  265. *-apple-darwin14*)
  266. PREFIX=/usr/local/iODBC.darwin
  267. CONFLAGS="--disable-shared --with-pic"
  268. CFLAGS="-O -m32"
  269. export CFLAGS CONFLAGS PREFIX
  270. $BUILD 32
  271. CFLAGS="-O -m64"
  272. export CFLAGS
  273. $BUILD 64
  274. PREFIX=/usr/local/iODBC.universal
  275. CONFLAGS="--disable-shared --with-pic --disable-dependency-tracking"
  276. CFLAGS="-O -mmacosx-version-min=10.9 -arch i386 -arch x86_64"
  277. export PREFIX CONFLAGS CFLAGS
  278. $BUILD universal
  279. ;;
  280. *-apple-darwin13*)
  281. PREFIX=/usr/local/iODBC.darwin
  282. CONFLAGS="--disable-shared --with-pic"
  283. CFLAGS="-O -m32"
  284. export CFLAGS CONFLAGS PREFIX
  285. $BUILD 32
  286. CFLAGS="-O -m64"
  287. export CFLAGS
  288. $BUILD 64
  289. PREFIX=/usr/local/iODBC.universal
  290. CONFLAGS="--disable-shared --with-pic --disable-dependency-tracking"
  291. CFLAGS="-O -mmacosx-version-min=10.8 -arch i386 -arch x86_64"
  292. export PREFIX CONFLAGS CFLAGS
  293. $BUILD universal
  294. ;;
  295. *-apple-darwin12*)
  296. PREFIX=/usr/local/iODBC.darwin
  297. CONFLAGS="--disable-shared --with-pic"
  298. CFLAGS="-O -m32"
  299. export CFLAGS CONFLAGS PREFIX
  300. $BUILD 32
  301. CFLAGS="-O -m64"
  302. export CFLAGS
  303. $BUILD 64
  304. PREFIX=/usr/local/iODBC.universal
  305. CONFLAGS="--disable-shared --with-pic --disable-dependency-tracking"
  306. CFLAGS="-O -mmacosx-version-min=10.7 -arch i386 -arch x86_64"
  307. export PREFIX CONFLAGS CFLAGS
  308. $BUILD universal
  309. ;;
  310. i[3456]86-apple-darwin11*)
  311. PREFIX=/usr/local/iODBC.darwin
  312. CONFLAGS="--disable-shared --with-pic"
  313. CFLAGS="-O -m32"
  314. export CFLAGS CONFLAGS PREFIX
  315. $BUILD 32
  316. CFLAGS="-O -m64"
  317. export CFLAGS
  318. $BUILD 64
  319. PREFIX=/usr/local/iODBC.universal
  320. CONFLAGS="--disable-shared --with-pic --disable-dependency-tracking"
  321. CFLAGS="-O -isysroot /Developer/SDKs/MacOSX10.7.sdk -mmacosx-version-min=10.7 -arch i386 -arch x86_64"
  322. export PREFIX CONFLAGS CFLAGS
  323. $BUILD universal
  324. ;;
  325. i[3456]86-apple-darwin10*)
  326. PREFIX=/usr/local/iODBC.darwin
  327. CONFLAGS="--disable-shared --with-pic"
  328. CFLAGS="-O -m32"
  329. export CFLAGS CONFLAGS PREFIX
  330. $BUILD 32
  331. CFLAGS="-O -m64"
  332. export CFLAGS
  333. $BUILD 64
  334. PREFIX=/usr/local/iODBC.universal
  335. CONFLAGS="--disable-shared --with-pic --disable-dependency-tracking"
  336. CFLAGS="-O -isysroot /Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6 -arch ppc -arch i386 -arch x86_64"
  337. export PREFIX CONFLAGS CFLAGS
  338. $BUILD universal
  339. ;;
  340. i[3456]86-apple-darwin9*)
  341. PREFIX=/usr/local/iODBC.darwin
  342. CONFLAGS="--disable-shared --with-pic"
  343. CFLAGS="-O -m32"
  344. export CFLAGS CONFLAGS PREFIX
  345. $BUILD 32
  346. CFLAGS="-O -m64"
  347. export CFLAGS
  348. $BUILD 64
  349. PREFIX=/usr/local/iODBC.universal
  350. CONFLAGS="--disable-shared --with-pic --disable-dependency-tracking"
  351. CFLAGS="-O -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5 -arch ppc -arch ppc64 -arch i386 -arch x86_64"
  352. export PREFIX CONFLAGS CFLAGS
  353. $BUILD universal
  354. ;;
  355. powerpc-apple-darwin8*)
  356. PREFIX=/usr/local/iODBC.darwin
  357. CONFLAGS="--disable-shared --with-pic"
  358. CFLAGS="-O -m32"
  359. export CFLAGS CONFLAGS PREFIX
  360. $BUILD 32
  361. CFLAGS="-O -m64"
  362. export CFLAGS
  363. $BUILD 64
  364. PREFIX=/usr/local/iODBC.universal
  365. CONFLAGS="--disable-shared --with-pic --disable-dependency-tracking"
  366. CFLAGS="-O -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 -arch ppc -arch ppc64 -arch i386"
  367. export PREFIX CONFLAGS CFLAGS
  368. $BUILD universal
  369. ;;
  370. powerpc-apple-darwin7*)
  371. PREFIX=/usr/local/iODBC.darwin
  372. CONFLAGS="--disable-shared --with-pic"
  373. CFLAGS="-O -DNO_FRAMEWORKS"
  374. export CFLAGS CONFLAGS PREFIX
  375. $BUILD
  376. ;;
  377. powerpc-apple-darwin6*)
  378. PREFIX=/usr/local/iODBC.darwin
  379. CONFLAGS="--disable-shared --with-pic"
  380. CFLAGS="-O -DNO_FRAMEWORKS -DMACOSX102"
  381. export CFLAGS CONFLAGS PREFIX
  382. $BUILD
  383. ;;
  384. ia64-hp-hpux11.23)
  385. CFLAGS="-O -Ae +DD32"
  386. export CFLAGS
  387. $BUILD 32
  388. CFLAGS="-O -Ae +DD64"
  389. export CFLAGS
  390. $BUILD 64
  391. ;;
  392. powerpc-ibm-aix5*)
  393. CC=cc_r
  394. CFLAGS="-O -q32"
  395. LDFLAGS="-brtl"
  396. OBJECT_MODE=32
  397. export CC CFLAGS LDFLAGS OBJECT_MODE
  398. $BUILD 32
  399. CC=cc_r
  400. CFLAGS="-O -q64"
  401. LDFLAGS="-brtl"
  402. OBJECT_MODE=64
  403. export CC CFLAGS LDFLAGS OBJECT_MODE
  404. $BUILD 64
  405. ;;
  406. *)
  407. CFLAGS="-O"
  408. export CFLAGS
  409. $BUILD
  410. ;;
  411. esac
  412. # End
  413. exit 0