2006-01-12 17:43:21 +00:00
|
|
|
#! /bin/sh
|
|
|
|
|
2006-01-12 18:20:48 +00:00
|
|
|
#
|
|
|
|
# Functions
|
|
|
|
#
|
|
|
|
usage()
|
|
|
|
{
|
|
|
|
cat << EOF
|
|
|
|
|
|
|
|
OpenSSL options:
|
|
|
|
--disable-openssl Disable OpenSSL, use built-in SHA1 implementation
|
|
|
|
--openssl-prefix=PATH Location of OpenSSL headers and library
|
2006-01-12 18:32:29 +00:00
|
|
|
--disable-gtk Don't build the GTK+ GUI
|
2006-01-12 18:20:48 +00:00
|
|
|
|
|
|
|
Some influential environment variables:
|
|
|
|
CC C compiler command (default "cc")
|
|
|
|
CFLAGS C compiler flags (default "-g -Wall -W")
|
|
|
|
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
|
|
|
openssl_test()
|
|
|
|
{
|
|
|
|
cat > testconf.c << EOF
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <openssl/sha.h>
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
SHA1( 0, 0, 0 );
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
if [ -n "$PREFIX" ]; then
|
|
|
|
TMPFLAGS="-I$PREFIX/include -L$PREFIX/lib"
|
|
|
|
fi
|
|
|
|
if $CC $TMPFLAGS -o testconf testconf.c -lcrypto > /dev/null 2>&1
|
|
|
|
then
|
|
|
|
echo "OpenSSL: yes"
|
|
|
|
DEFINES="$DEFINES HAVE_OPENSSL"
|
|
|
|
LINKLIBS="$LINKLIBS -lcrypto"
|
|
|
|
else
|
|
|
|
echo "OpenSSL: no, using built-in SHA1 implementation"
|
|
|
|
fi
|
|
|
|
rm -f testconf.c testconf
|
|
|
|
}
|
|
|
|
|
2006-01-12 18:32:29 +00:00
|
|
|
gtk_test()
|
|
|
|
{
|
2006-01-12 18:33:20 +00:00
|
|
|
if pkg-config gtk+-2.0 > /dev/null 2>&1
|
2006-01-12 18:32:29 +00:00
|
|
|
then
|
2006-01-12 18:45:41 +00:00
|
|
|
if expr `pkg-config --modversion gtk+-2.0` '>=' 2.6.0 > /dev/null 2>&1
|
2006-01-12 18:33:20 +00:00
|
|
|
then
|
2006-01-12 18:45:41 +00:00
|
|
|
cat > testconf.c << EOF
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
gtk_main();
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
if $CC `pkg-config gtk+-2.0 --cflags --libs` -o testconf testconf.c > /dev/null 2>&1
|
|
|
|
then
|
|
|
|
echo "GTK+: yes"
|
|
|
|
GTK=yes
|
|
|
|
GTKCCFLAGS=`pkg-config gtk+-2.0 --cflags`
|
|
|
|
GTKLINKLIBS=`pkg-config gtk+-2.0 --libs`
|
|
|
|
else
|
|
|
|
echo "GTK+: no"
|
|
|
|
GTK=no
|
|
|
|
fi
|
|
|
|
rm -f testconf.c testconf
|
2006-01-12 18:33:20 +00:00
|
|
|
else
|
2006-01-12 18:45:41 +00:00
|
|
|
echo "GTK+: no (2.6.0 or later is required)"
|
2006-01-12 18:33:20 +00:00
|
|
|
GTK=no
|
|
|
|
fi
|
2006-01-12 18:32:29 +00:00
|
|
|
else
|
2006-01-12 18:33:20 +00:00
|
|
|
echo "GTK+: no"
|
2006-01-12 18:32:29 +00:00
|
|
|
GTK=no
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2006-01-12 18:20:48 +00:00
|
|
|
#
|
|
|
|
# Defaults settings
|
|
|
|
#
|
|
|
|
CC="${CC-cc}"
|
|
|
|
CFLAGS="${CFLAGS--g -Wall -W}"
|
2006-01-12 17:43:21 +00:00
|
|
|
# For > 2 GB files
|
|
|
|
DEFINES="_FILE_OFFSET_BITS=64 _LARGEFILE_SOURCE"
|
|
|
|
# For asprintf
|
|
|
|
DEFINES="$DEFINES _GNU_SOURCE"
|
2006-01-12 18:20:48 +00:00
|
|
|
openssl_disable=0
|
2006-01-12 18:32:29 +00:00
|
|
|
gtk_disable=0
|
|
|
|
GTK=no
|
|
|
|
GTKCCFLAGS=
|
|
|
|
GTKLINKLIBS=
|
2006-01-12 18:20:48 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Parse options
|
|
|
|
#
|
|
|
|
while [ $# -ne 0 ]; do
|
|
|
|
param=`expr "opt$1" : 'opt[^=]*=\(.*\)'`
|
|
|
|
|
|
|
|
case "x$1" in
|
|
|
|
x--disable-openssl)
|
|
|
|
openssl_disable="1";
|
|
|
|
;;
|
|
|
|
x--openssl-prefix=*)
|
|
|
|
OPENSSL_PREFIX="$param";
|
|
|
|
;;
|
2006-01-12 18:32:29 +00:00
|
|
|
x--disable-gtk)
|
|
|
|
gtk_disable="1";
|
|
|
|
;;
|
2006-01-12 18:20:48 +00:00
|
|
|
x--help)
|
|
|
|
usage
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
2006-01-12 17:43:21 +00:00
|
|
|
|
2006-01-12 18:20:48 +00:00
|
|
|
#
|
2006-01-12 17:43:21 +00:00
|
|
|
# System-specific flags
|
2006-01-12 18:20:48 +00:00
|
|
|
#
|
2006-01-12 17:43:21 +00:00
|
|
|
SYSTEM=`uname -s`
|
|
|
|
case $SYSTEM in
|
|
|
|
BeOS)
|
|
|
|
DEFINES="$DEFINES SYS_BEOS"
|
|
|
|
|
2006-01-12 18:52:15 +00:00
|
|
|
CC="gcc"
|
|
|
|
MACHINE=`uname -m`
|
|
|
|
case $MACHINE in
|
|
|
|
BePC) # BeOS on x86
|
|
|
|
CPU="x86"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
CPU="ppc"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
SYSTEM="$SYSTEM / $CPU"
|
|
|
|
|
2006-01-12 17:43:21 +00:00
|
|
|
RELEASE=`uname -r`
|
|
|
|
case $RELEASE in
|
|
|
|
6.0|5.0.4) # Zeta or R5 / BONE beta 7
|
|
|
|
SYSTEM="$SYSTEM / BONE"
|
|
|
|
LINKLIBS="$LINKLIBS -lbind -lsocket"
|
|
|
|
;;
|
|
|
|
5.0*) # R5 / net_server
|
|
|
|
SYSTEM="$SYSTEM / net_server"
|
|
|
|
DEFINES="$DEFINES BEOS_NETSERVER"
|
|
|
|
LINKLIBS="$LINKLIBS -lnet"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Unsupported BeOS version"
|
2006-01-12 18:52:15 +00:00
|
|
|
exit 1
|
|
|
|
;;
|
2006-01-12 17:43:21 +00:00
|
|
|
esac
|
|
|
|
;;
|
|
|
|
|
|
|
|
Darwin)
|
|
|
|
DEFINES="$DEFINES SYS_DARWIN"
|
|
|
|
LINKLIBS="$LINKLIBS -lpthread"
|
|
|
|
;;
|
|
|
|
|
|
|
|
FreeBSD)
|
|
|
|
DEFINES="$DEFINES SYS_FREEBSD"
|
|
|
|
LINKLIBS="$LINKLIBS -pthread"
|
|
|
|
;;
|
|
|
|
|
|
|
|
NetBSD)
|
|
|
|
DEFINES="$DEFINES SYS_NETBSD"
|
|
|
|
LINKLIBS="$LINKLIBS -lpthread"
|
|
|
|
;;
|
|
|
|
|
|
|
|
Linux)
|
|
|
|
DEFINES="$DEFINES SYS_LINUX"
|
|
|
|
LINKLIBS="$LINKLIBS -lpthread"
|
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
|
|
|
echo "Unsupported operating system"
|
|
|
|
exit 1 ;;
|
|
|
|
esac
|
|
|
|
echo "System: $SYSTEM"
|
|
|
|
|
2006-01-12 18:20:48 +00:00
|
|
|
#
|
|
|
|
# OpenSSL settings
|
|
|
|
#
|
|
|
|
if [ ${openssl_disable} = 1 ]; then
|
2006-01-12 17:43:21 +00:00
|
|
|
echo "OpenSSL: no, using built-in SHA1 implementation"
|
2006-01-12 18:20:48 +00:00
|
|
|
else
|
|
|
|
openssl_test
|
2006-01-12 17:43:21 +00:00
|
|
|
fi
|
|
|
|
|
2006-01-12 18:32:29 +00:00
|
|
|
#
|
|
|
|
# GTK settings
|
|
|
|
#
|
|
|
|
if [ ${gtk_disable} = 1 ]; then
|
2006-01-12 18:33:20 +00:00
|
|
|
echo "GTK+: no"
|
2006-01-12 18:32:29 +00:00
|
|
|
else
|
|
|
|
gtk_test
|
|
|
|
fi
|
|
|
|
|
2006-01-12 18:20:48 +00:00
|
|
|
#
|
2006-01-12 17:43:21 +00:00
|
|
|
# Generate config.jam
|
2006-01-12 18:20:48 +00:00
|
|
|
#
|
2006-01-12 17:43:21 +00:00
|
|
|
rm -f config.jam
|
2006-01-12 18:20:48 +00:00
|
|
|
cat > config.jam << EOF
|
2006-01-12 18:32:29 +00:00
|
|
|
CC = $CC ;
|
|
|
|
LINK = $CC ;
|
|
|
|
CCFLAGS = $CFLAGS ;
|
|
|
|
DEFINES = $DEFINES ;
|
|
|
|
LINKLIBS = $LINKLIBS ;
|
|
|
|
GTK = $GTK ;
|
|
|
|
GTKCCFLAGS = $GTKCCFLAGS ;
|
|
|
|
GTKLINKLIBS = $GTKLINKLIBS ;
|
2006-01-12 17:43:21 +00:00
|
|
|
EOF
|
2006-01-12 18:20:48 +00:00
|
|
|
if [ -n "$OPENSSL_PREFIX" ]; then
|
|
|
|
cat >> config.jam << EOF
|
2006-01-12 18:32:29 +00:00
|
|
|
HDRS += $OPENSSL_PREFIX/include ;
|
|
|
|
LINKFLAGS += -L$OPENSSL_PREFIX/lib ;
|
2006-01-12 18:20:48 +00:00
|
|
|
EOF
|
|
|
|
fi
|
2006-01-12 18:52:15 +00:00
|
|
|
if [ -n "$CPU" ]; then
|
|
|
|
cat >> config.jam << EOF
|
|
|
|
CPU = $CPU ;
|
|
|
|
EOF
|
|
|
|
fi
|
2006-01-12 17:43:21 +00:00
|
|
|
|
|
|
|
echo
|
|
|
|
echo "To build Transmission, run 'jam'."
|