unrealircd

- supernets unrealircd source & configuration
git clone git://git.acid.vegas/unrealircd.git
Log | Files | Refs | Archive | README | LICENSE

select-config (3638B)

      1 #!/bin/bash
      2 #
      3 # This is a helper script for travis-ci builds and our own FreeBSD test machine.
      4 # It is not meant to be used by end-users
      5 #
      6 
      7 function fail()
      8 {
      9 	echo "select-config failed: $*"
     10 	exit 1
     11 }
     12 
     13 function build_ssl {
     14 	DIR="$2"
     15 	URL="$1/$2.tar.gz"
     16 	savewd="$PWD"
     17 	cd ~
     18 	wget "$URL" || exit 1
     19 	tar xzf $DIR.tar.gz
     20 	cd "$DIR"
     21 	(./configure --prefix=$HOME/ssl 1>/dev/null 2>&1 || ./config --prefix=$HOME/ssl -fPIC 1>/dev/null 2>&1 ) || fail "build_ssl: configure/config failed"
     22 	(make -j2 1>/dev/null 2>&1 && make install 1>/dev/null 2>&1) || fail "build_ssl: make failed"
     23 	cd "$savewd"
     24 	echo "SSLDIR=$HOME/ssl" >>config.settings
     25 }
     26 
     27 if [ ! -d extras ]; then
     28 	echo "This tool is supposed to be run from the source root, so ~/unrealircd-5.0.x or similar"
     29 	exit 1
     30 fi
     31 
     32 set -x
     33 
     34 # Take default settings as a starter..
     35 cp extras/build-tests/nix/configs/default ./config.settings
     36 
     37 # Libtool is required for the other options..
     38 # Also for our FreeBSD machine we have to uninstall some stuff since a clean
     39 # environment is not guaranteed...
     40 if [ "$OSTYPE" = "linux-gnu" ]; then
     41 	sudo apt-get -qq update
     42 	sudo apt-get install libtool -qq
     43 elif [[ "$OSTYPE" == "freebsd"* ]]; then
     44 	sudo pkg install -y libtool
     45 	sudo pkg remove -y c-ares
     46 elif [[ "$OSTYPE" == "darwin"* ]]; then
     47 	brew update
     48 	brew install openssl
     49 else
     50 	echo "OS not correctly detected ($OSTYPE). Aborting."
     51 	exit 1
     52 fi
     53 
     54 echo "*****************************************************************"
     55 echo "SELECTED BUILD OPTIONS: $*"
     56 echo "*****************************************************************"
     57 
     58 while [ "$1" ]
     59 do
     60 	echo "Processing option $1..."
     61 	if [ "$1" = "system-cares" ]; then
     62 		if [ "$OSTYPE" = "linux-gnu" ]; then
     63 			sudo apt-get install libc-ares-dev -qq
     64 		elif [[ "$OSTYPE" == "freebsd"* ]]; then
     65 			sudo pkg install -y c-ares
     66 		elif [[ "$OSTYPE" == "darwin"* ]]; then
     67 			brew install c-ares
     68 		fi
     69 	elif [ "$1" = "system-curl" ]; then
     70 		echo 'REMOTEINC=1' >>config.settings
     71 		if [ "$OSTYPE" = "linux-gnu" ]; then
     72 			sudo apt-get install libcurl4-openssl-dev -qq
     73 			echo 'CURLDIR=/usr' >>config.settings
     74 		elif [[ "$OSTYPE" == "freebsd"* ]]; then
     75 			sudo pkg install -y curl
     76 			echo 'CURLDIR=/usr/local' >>config.settings
     77 		elif [[ "$OSTYPE" == "darwin"* ]]; then
     78 			brew install c-ares curl
     79 			echo 'CURLDIR=/usr/local/opt/curl' >>config.settings
     80 		fi
     81 	elif [ "$1" = "local-curl" ]; then
     82 		if [ "$OSTYPE" = "linux-gnu" ]; then
     83 			sudo apt-get remove libcurl4-openssl-dev libcurl3-gnutls libcurl3 -qq
     84 		elif [[ "$OSTYPE" == "freebsd"* ]]; then
     85 			sudo pkg remove -y curl #NOTE: unfortunately this also removes 'git' :D
     86 		elif [[ "$OSTYPE" == "darwin"* ]]; then
     87 			echo "No need to remove curl since it's not installed. Or at least I hope so..."
     88 		fi
     89 		echo 'REMOTEINC=1' >>config.settings
     90 		echo "CURLDIR=`pwd`/extras/curl" >>config.settings
     91 	elif [ "$1" = "libressl-27" ]; then
     92 		build_ssl https://ftp.openbsd.org/pub/OpenBSD/LibreSSL libressl-2.7.5
     93 	elif [ "$1" = "libressl-28" ]; then
     94 		build_ssl https://ftp.openbsd.org/pub/OpenBSD/LibreSSL libressl-2.8.3
     95 	elif [ "$1" = "libressl-29" ]; then
     96 		build_ssl https://ftp.openbsd.org/pub/OpenBSD/LibreSSL libressl-2.9.0
     97 	elif [ "$1" = "openssl-102" ]; then
     98 		build_ssl https://www.openssl.org/source openssl-1.0.2q
     99 	elif [ "$1" = "openssl-110" ]; then
    100 		build_ssl https://www.openssl.org/source openssl-1.1.0j
    101 	elif [ "$1" = "openssl-111" ]; then
    102 		build_ssl https://www.openssl.org/source openssl-1.1.1a
    103 	else
    104 		echo "Unknown option $1"
    105 		exit 1
    106 	fi
    107 	shift
    108 done
    109 
    110 if [[ "$OSTYPE" == "darwin"* ]]; then
    111 	echo "NOTE: Not building with -Werror for now on macOS..."
    112 else
    113 	echo 'EXTRAPARA="--enable-werror"' >>config.settings
    114 fi