File: build_freetds.sh

package info (click to toggle)
mysql-workbench 6.3.8%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 113,932 kB
  • ctags: 87,814
  • sloc: ansic: 955,521; cpp: 427,465; python: 59,728; yacc: 59,129; xml: 54,204; sql: 7,091; objc: 965; makefile: 638; sh: 613; java: 237; perl: 30; ruby: 6; php: 1
file content (83 lines) | stat: -rwxr-xr-x 2,011 bytes parent folder | download | duplicates (2)
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
#!/bin/bash
# Script to compile FreeTDS against ODBC in distributions supported by WB

function determine_distro()
{
    if [ -d /var/lib/rpm ]; then
       # RPM based distro
       echo el
    else
       # deb based distro
       echo ubuntu
    fi
}

distro=`determine_distro`

if test "$distro" = "el"; then
	libiodbc=libiodbc-devel
elif test "$distro" = "fc"; then
	libiodbc=libiodbc-devel
elif test "$distro" = "ubuntu"; then
	libiodbc=libiodbc2-dev
fi

echo "Checking requisites..."
# check if deps are installed
if ! type -a iodbc-config; then
    echo "ERROR: Package $libiodbc is not installed. Install it and try again"
    exit 1
fi

if ! type -a gcc; then
	echo "ERROR: gcc is not installed. Install it and try again"
	exit 1
fi

freetds_tarball=`find . -maxdepth 1 -type f -regex '\./freetds-.*\(\.tar\.gz\|\.tgz\)' -printf "%f" -quit`
if [ -z $freetds_tarball ]; then
    echo "ERROR: Please download the latest freetds (requires 0.92 or newer) source package to this directory"
    exit 1
else
    echo "FreeTDS tarball found: $freetds_tarball"
fi

echo "Compiling freetds..."
rm -fr /tmp/freetdsbuild
mkdir /tmp/freetdsbuild

cp $freetds_tarball /tmp/freetdsbuild

cd /tmp/freetdsbuild

echo "Extracting files from $freetds_tarball..."
tar xzf $freetds_tarball

if `uname` = darwin; then
# force 32bit build
export CFLAGS="-arch i386"
export LDFLAGS="-arch i386"
fi

if iodbc-config --cflags|grep -- -I; then
    ln -s `iodbc-config --cflags|sed -e "s/.*-I\([^ ]*\).*/\1/"` include
else
    ln -s /usr/include .
fi

if iodbc-config --libs|grep -- -L; then
	ln -s `iodbc-config --libs|sed -e "s/.*-L\([^ ]*\).*/\1/"` .
else
	if test `arch` = x86_64; then
		ln -s /usr/lib64 .
	else
		ln -s /usr/lib .
	fi
fi

cd freetds-*[0-9]
./configure --disable-apps --disable-server --disable-pool --with-iodbc=/tmp/freetdsbuild --enable-odbc-wide
make
echo "Go to `pwd` and type make install as the root user"
echo "After that, install the driver which will be installed as /usr/local/lib/libtdsodbc.so"