File: build-wx-3.0.sh

package info (click to toggle)
3depict 0.0.21-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 17,908 kB
  • sloc: cpp: 72,771; sh: 6,497; xml: 1,576; python: 326; makefile: 194; ansic: 186
file content (172 lines) | stat: -rwxr-xr-x 4,740 bytes parent folder | download | duplicates (5)
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
#!/bin/bash
BASE=`pwd`

BUILD_STATUS_FILE="$BASE/build-status"
PATCH_STATUS_FILE="$BASE/patch-status"

PATCHES_WXWIDGETS_PRE="" #wxWidgets-2.8.12-mingw64-1.patch configure-wxbool-patch"
PATCHES_WXWIDGETS_POST="wx-config-sysroot.patch"

if [ ! -f host_val ] ; then
	echo "Please select 32 or 64 bit by typing \"32\" or \"64\" (32/64)"
	read HOST_VAL
	
	case $HOST_VAL in
		32)
			HOST_VAL="i686-w64-mingw32"
			;;
		64)
			HOST_VAL="x86_64-w64-mingw32"
			;;
		
		*) 
			echo "Didn't understand HOST_VAL. You can override this by editing the script"
			exit 1
		;;
	esac

	#Save for next run
	echo $HOST_VAL > host_val
else
	HOST_VAL=`cat host_val`
fi


if [ $HOST_VAL != "x86_64-w64-mingw32" ] && [ $HOST_VAL != i686-w64-mingw32 ] ; then
	echo "Unknown HOST_VAL"
	exit 1
fi

PREFIX=/
NUM_PROCS=4

if [ `id -u` -eq 0 ]; then
	echo "This script should not be run as root."
	echo " If you know what you are doing, you can disable this check, but be aware you _can_ break your system by doing this."
	exit 1;
fi

function applyPatches()
{
	for i in $APPLY_PATCH_ARG
	do
		if [ x"`cat $PATCH_STATUS_FILE | grep "$i"`" != x"" ] ; then
			echo "Patch already applied :" $i
			continue
		fi

		echo "Applying patch:" $i
		patch -tN -p$PATCH_LEVEL  < $BASE/patches/$i
		
		if [ $? -ne 0 ] ; then
			echo "Failed applying patch :" $i
			exit 1
		fi
		echo "applied patch"
		echo $i >> $PATCH_STATUS_FILE
	done
}
function isBuilt()
{
	if [ x`cat ${BUILD_STATUS_FILE} | grep $ISBUILT_ARG` != x"" ]  ; then
		ISBUILT=1
	else
		ISBUILT=0
	fi
}

function build_wx()
{
	NAME="libwx"
	ISBUILT_ARG=${NAME}
	isBuilt

	if [ $ISBUILT -eq 1 ] ; then
		return;
	fi
	
	pushd deps >/dev/null
	pushd wxWidgets-3.0* >/dev/null
       	
	if [ $? -ne 0 ] ; then
		echo "wxwidgets dir missing, or duplicated?"
		exit 1
	fi

	make clean

#	APPLY_PATCH_ARG=$PATCHES_WXWIDGETS_PRE
#	applyPatches
#WX_DISABLE="--disable-compat26 --disable-ole --disable-dataobj --disable-ipc --disable-apple_ieee --disable-zipstream --disable-protocol_ftp --disable-mshtmlhelp --disable-aui --disable-mdi --disable-postscript --disable-datepick --disable-splash --disable-wizarddlg --disable-joystick --disable-loggui --disable-debug --disable-logwin --disable-logdlg --disable-tarstream --disable-fs_archive --disable-fs_inet --disable-fs_zip --disable-snglinst --disable-sound --without-regex --disable-svg --disable-webview --disable-markup --disable-banner-window --disable-calendar --disable-mediactrl --disable-stc --disable-timepick --disable-treebook --disable-toolbook --disable-finddlg --disable-prefseditor --disable-editablebox  --disable-compat28 --disable-ftp --disable-ole --disable-arcstream --disable-dialupman --disable-sound --disable-protocol_ftp --disable-html --disable-htmlhelp --disable-ribbon --disable-tarstrema --disable-zipstream --disable-propgrid --disable-richtext --disable-richtooltip"

	./configure --host=$HOST_VAL --enable-monolithic --disable-compat28 --disable-propgrid --enable-shared --disable-static --with-opengl --enable-msw --prefix=/ || { echo "wxwidgets configure failed"; exit 1; } 

	#TODO: Where is this coming from ???
	for i in `find ./ -name Makefile | grep -v samples | grep -v wxPython`
	do
		sed -i "s@-luuid-L@ -luuid -L@" $i
	done	
	
	make -j $NUM_PROCS || { echo "wxwidgets build failed"; exit 1; } 
	make install DESTDIR="$BASE"|| { echo "wxwidgets install failed"; exit 1; } 


	
	popd >/dev/null
	popd >/dev/null

	pushd ./bin/
	unlink wx-config
	cp `find ${BASE}/lib/wx/config/ -name \*unicode-3.0` wx-config
	APPLY_PATCH_ARG=$PATCHES_WXWIDGETS_POST
	PATCH_LEVEL=0
#applyPatches
	PATCH_LEVEL=1
	sed -i "s@REPLACE_BASENAME@${BASE}@" wx-config || { echo "Failed to update wx-config with build root,. Aborting";  exit 1; }
	popd

	pushd ./lib/
	ln -s wx-2.8/wx/ wx
	popd


	echo ${NAME} >> $BUILD_STATUS_FILE

}

#Install cross compiler
#---
case ${HOST_VAL}  in
	x86_64-w64-mingw32)
		if [ x"$DIST_NAME" == x"Ubuntu" ] || [ x"$DIST_NAME" == x"LinuxMint" ] ; then
			MINGW_PACKAGES="mingw-w64-dev g++-mingw-w64-x86-64"
		else
		MINGW_PACKAGES="mingw-w64-x86-64-dev g++-mingw-w64-x86-64"
		fi
		HOST_EXT="win64"
	;;
	i686-w64-mingw32)
		MINGW_PACKAGES="gcc-mingw32"
		HOST_EXT="win32"
	;;
	*)
		echo "Unknown host... please install deps manually,or alter script"
		exit 1	
	;;
esac


#set our needed environment variables
PATH=${BASE}/bin/:/usr/$HOST_VAL/bin/:$PATH
export CXX=${HOST_VAL}-g++
export CPP=${HOST_VAL}-cpp
export CC=${HOST_VAL}-gcc
export CPPFLAGS=-I${BASE}/include/
export CFLAGS=-I${BASE}/include/
export CXXFLAGS=-I${BASE}/include/
export LDFLAGS=-L${BASE}/lib/
export RANLIB=${HOST_VAL}-ranlib
export LIBS="-L${BASE}/lib/"
DESTDIR=${BASE}

build_wx	# I'm not sure I've done this 100% right. Check wx-config output