summaryrefslogtreecommitdiff
path: root/compiz-fusion-git-build
blob: ce1347a94e684860ac385c65203467bac050ca95 (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
#!/bin/bash
# Compiz Fusion Git Build Script

### DO NOT EDIT BELOW THIS LINE ###

source $(dirname ${0})/compiz-fusion-git-functions
source $(dirname ${0})/compiz-fusion-git-config

# Calculate the packages we will be building

COMPIZ=$(remove_unwanted_packages ${COMPIZ[*]})
FUSION=$(remove_unwanted_packages ${FUSION[*]})
MISC=$(remove_unwanted_packages ${MISC[*]})
LIBS=$(remove_unwanted_packages ${LIBS[*]})
CONFIG=$(remove_unwanted_packages ${CONFIG[*]})
DECORATORS=$(remove_unwanted_packages ${DECORATORS[*]})
PLUGIN_CONTAINERS=$(remove_unwanted_packages ${PLUGIN_CONTAINERS[*]})
PLUGINS=$(remove_unwanted_packages ${PLUGINS[*]})

ALL="${COMPIZ} ${FUSION} ${MISC} ${LIBS} ${CONFIG} ${DECORATORS} ${PLUGIN_CONTAINERS} ${PLUGINS}"

## Build Process

# We need a dir so that we can track the files installed
if [[ ! -d $GIT_LOCATION/.file_list ]]; then
	mkdir -p $GIT_LOCATION/.file_list
fi

cd $GIT_LOCATION

function build() {
	for x in "$@"
	do
		# We're in $ALL, we're building this package
		if [[ $(echo $ALL | grep -o $x) == $x ]]; then
			ALL=$(echo $ALL | sed "s/$x//") # Remove $x from $ALL
			if [[ ! -e $x ]]; then
				die '*** ERROR: Package has not been checked out: '${x}''
			fi

			echo "==> Building: '$x'"

			# Cleanup
			$BUILD_SUDO rm -rf .${x}_install .${x}_build

			# Create a tmp dir, so we don't screw up the checkout
			cp -a $x .${x}_build
			cd .${x}_build

			BUILD_ARGS=""
			if [[ $x == "compiz" ]]; then
				BUILD_ARGS=${BUILD_COMPIZ_ARGS}
			fi

			if [[ -e autogen.sh ]]; then
				# Run autogen.sh and make
				echo "./autogen.sh --prefix=${BUILD_PREFIX}"
				./autogen.sh --prefix=${BUILD_PREFIX} ${BUILD_ARGS} || die '*** ERROR: Package failed to run autogen.sh: '${x}''

			# We don't have autogen.sh, if we don't have a makefile, we can't build, this is a psuedo else
			elif [[ ! -e Makefile ]]; then
				die '*** ERROR: Package does not have a proper build system: '${x}''
			fi

			# Run make
			make || die '*** ERROR: Package failed to run make: '$x''

			# Run make install, and install to a tmp location
			# Not working, real DESTDIR should be DESTDIR="${GIT_LOCATION}/.${x}_install"
			$BUILD_SUDO make install || die '*** ERROR: Package failed to run make install: '${x}''

			cd ../

#			# Remove old installation
#			if [[ -e .file_list/$x ]]; then
#				$BUILD_SUDO rm -rf $(<.file_list/$x)
#			fi
#
#			# Create list of new files
#			rm -f .file_list/$x
#
#			cd .${x}_install
#			find -depth -type d -empty -delete
#			tar cvf /dev/null * | sort | sed 's/^/\//' > ../.file_list/$x
#
#			# Install
#			for y in *
#			do
#				# We are copying from the tmp install to /
#				$BUILD_SUDO cp -a ${y} /${y}
#			doneDESTDIR="${GIT_LOCATION}/.${x}_install
#			cd ../
#
			# Cleanup
			$BUILD_SUDO rm -rf .${x}_install .${x}_build
		else
			echo '* Warning: Package is not supposed to be built, but build was called for it '${x}''
		fi
	done
}

# Build some packages in order, or else it will fail to build
build "compiz" "bcop" "libcompizconfig" "compizconfig-python" "ccsm"

# Build the rest - The previous packages were removed from $ALL
build ${ALL}

echo "Compiz Fusion has been built"
exit 0