summaryrefslogtreecommitdiff
path: root/rebuild
blob: b9017671e0b54ab41c6c8d842e9fe80c71b53c65 (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
#!/bin/sh
# rebuild
# (c) 2002 Karel 'Clock' Kulhavy, Mikulas Patocka, Petr 'Brain' Kulhavy
# This file is a part of the Links program, released under GPL.

make=make
if which gmake 2>/dev/null >/dev/null && gmake --version | grep -i "GNU Make" >/dev/null
then
echo Found GNU Make under gmake. Going to use gmake instead of make.
make=gmake
fi

if which autoheader-2.13 2>/dev/null >/dev/null
then
autoheader="autoheader-2.13"
else
autoheader="autoheader"
fi

if [ "$1" = reconf ]; then
	if ! which pkg-config 2>/dev/null >/dev/null
	then
	echo Warning: You don\'t have pkg-config. The PKG_CHECK_MODULES macro will probably fail. >&2	
	fi

	if ! which autoconf 2>/dev/null >/dev/null
	then
		echo You don\'t have autoconf. Wiping out. >&2
		exit 1
	fi

	if ! autoconf --version | grep -i "GNU Autoconf" >/dev/null
	then
		echo This looks like autoconf installed on OpenBSD. >&2
		if ! AUTOCONF_VERSION=2.13 autoconf --version 2>/dev/null >/dev/null
		then
			echo Autoconf 2.13 is not found. This script needs at most autoconf 2.13. \
			Trying with some other \(random\) autoconf. >&2
			path=`echo "$PATH" | tr -s ':' '\n'`
			alt=`find $path -name 'autoconf*' -and ! -name autoconf | head -n 1`
			if [ -z "$alt" ]
				then
				echo Cannot find the real autoconf >&2
				exit 1
			fi
			export AUTOCONF_VERSION=`echo $alt | sed -e 's/^.*autoconf-//g'`
			echo Found $alt. Setting AUTOCONF_VERSION to $AUTOCONF_VERSION.>&2
		else
			echo Found Autoconf 2.13. It should work. >&2
			export AUTOCONF_VERSION=2.13
		fi
	fi

	if ! automake --version | grep -i "GNU automake" >/dev/null
	then
		echo This looks like automake installed on OpenBSD. >&2
		export AUTOMAKE_VERSION=1.4
		if ! automake --version 2>/dev/null >/dev/null
		then
			echo Automake 1.4 is needed. Wiping out. >&2
			exit 1
		fi
		echo Found Automake 1.4. It should work. >&2
	fi
fi

rm -f config.h Makefile config.cache &&
if [ "$1" = reconf ]; then
	echo NEPOUZIVAT pokud nebylo zmeneno configure.in nebo Makefile.am !!! &&
        echo DO NOT use unless configure.in or Makefile.am has been changed !!! &&
	echo rebuild reconf se NESMI prerusit protoze pak by pri nasledujicim commitu byly commitnuty spatne dependence a pri kompilaci by tise vznikaly zahadne neodladitelne chyby!!! &&
	echo rebuild reconf MUST NOT be interrupted because after the following commit bad dependencies would be commited and during compilation, mysterious and undebuggable bugs would originate!!! &&
	echo Timto mistoprisezne prohlasuji ze toto skutecne nastalo a ze proces neprerusim. &&
	echo I hereby affirm that this really has happened and I won\'t break the process. &&
	read kecy &&
	if [ "$kecy" = "ano" -o "$kecy" = "Ano" -o "$kecy" = "yes" -o "$kecy" = "Yes" ]; then
		echo Zodpovednost prijata. &&
		echo Responsibility accepted. &&
		rm -rf .deps missing depcomp aclocal.m4 &&
		$autoheader &&
		rm -f autoh* &&
		aclocal &&
		automake --add-missing &&
		sed 's%sed '\''s/\\\.am\$/\.in/'\''%sed '\''s/\\\.[aA][mM]\$/\.in/'\''%' <missing >missing.tmp &&
		mv -f missing.tmp missing &&
		chmod a+x missing &&
		autoconf
	else
		exit
	fi
fi &&
if [ "$1" = reconf_aby_to_brain_nepouzival ]; then
	echo "Mikulasi, vyser si voko!" &&
	exit
fi &&
#cd Unicode;./gen; cd ..
#cd intl; ./synclang; cd ..
export CFLAGS="$CFLAGS -Wall -g -O2 -pipe -ansi -U__STRICT_ANSI__ -fno-common" &&
#export CFLAGS="-Wall -g -O2 -pipe"
export CXXFLAGS="$CXXFLAGS -Wall -g -O2 -pipe" &&
./configure --enable-graphics --enable-debuglevel=2 &&
$make clean &&
$make &&
if [ "$1" = reconf ]; then
	$autoheader &&
	automake --add-missing --include-deps --build-dir=. --srcdir-name=. --output-dir=. &&
	sed 's%sed '\''s/\\\.am\$/\.in/'\''%sed '\''s/\\\.[aA][mM]\$/\.in/'\''%' <missing >missing.tmp &&
	mv -f missing.tmp missing &&
	chmod a+x missing &&
	sed -n '{h;s/X11R6/X11R7/p;x;p;}' <configure >configure.tmp &&
	mv -f configure.tmp configure &&
	chmod a+x configure &&
	./configure --enable-graphics
	if [ $? != 0 ]; then echo CONFIGURE FAILED; exit 1; fi
fi