aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/mkpkg
blob: 4db0fefbc06b46fb7bda128022d9faf7d606d78d (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
#!/bin/bash
OK=0
FAIL=1
TOPDIR=`pwd`
LOG_FILE=$1.log
LOG_DIR=${TOPDIR}/log/
LOG=${LOG_DIR}/${LOG_FILE}
DEPENDENCY=${LOG_DIR}/DEPEND/$1.depend.txt

LOG_OK_DIR=${LOG_DIR}/OK
LOG_FAIL_DIR=${LOG_DIR}/FAIL
LOG_OK_FILE=${LOG_OK_DIR}/${LOG_FILE}.OK
LOG_FAIL_FILE=${LOG_FAIL_DIR}/${LOG_FILE}.FAIL

mkdir -p ${LOG_DIR}
mkdir -p ${LOG_OK_DIR}
mkdir -p ${LOG_FAIL_DIR}
mkdir -p ${LOG_DIR}/DEPEND

test=${OK}

function	clean_files()
{
	rm -f ${LOG}
	rm -f ${LOG_OK_FILE}
	rm -f ${LOG_FAIL_FILE}
	rm -f ${DEPENDENCY}
}

function	dirclean ()
{
	make $1-dirclean > /dev/null 2>&1
}

function	process ()
{
	make $1 >> ${LOG} 2>&1 || test=${FAIL}
	grep "\.tar\." ${LOG} > ${DEPENDENCY}
	if [ ${test} = ${OK} ] ; then
		mv ${LOG} ${LOG_OK_FILE}
		printf "%-16s" "OK"
		if [ "${2}X" != "X" ] ; then
			printf	"%-16s"	"\"$2\"";
		fi
		if [ "${3}X" != "X" ] ; then
			printf	"%s"	"\"$3\"";
		fi
		echo
	else
		mv ${LOG} ${LOG_FAIL_FILE}
		printf "%-16s" "FAIL"
		if [ "${2}X" != "X" ] ; then
			printf	"%-16s"	"\"$2\"";
		else
			printf	"%-16s"	"\"\""
		fi
		if [ "${3}X" != "X" ] ; then
			printf	"%s"	"\"$3\"";
		fi
		echo
	fi
}

function build_package ()
{
	# echo "BUILD PACKAGE:1=$1 2=$2 3=$3 4=$4 5=$5 6=$6 7=$7"
	printf "mk	%-32s" "$1"
	if [ "$2X" = "X" ] ; then		# no parameters
		clean_files	$1
		dirclean	$1
		process		$1 "$3"
	elif [ "$2X" = "?X" ] ; then		# no parameters
		clean_files	$1
		dirclean	$1
		process		$1 "$3"
	elif [ "$2X" = "OKX" ] ; then	# Previous build was OK
		clean_files	$1
		dirclean	$1
		process		$1 "$3"
	elif [ "$2X" = "FAILX" ] ; then
		clean_files	$1
		dirclean	$1
		process		$1 "$3"
	elif [ "$2X" = "BROKENX" ] ; then
		printf  "%-16s" "BROKEN"
		if [ "${3}X" != "X" ] ; then
			printf	"%s"	"\"$3\"";
		fi
		echo
	elif [ "$2X" = "DISABLEDX" ] ; then
		printf  "%-16s" "DISABLED"
		if [ "${3}X" != "X" ] ; then
			printf	"%s"	"\"$3\"";
		fi
		echo
	else
		printf  "%-16s" "?BROKEN"
		if [ "${3}X" != "X" ] ; then
			printf	"%s"	"\"$3\"";
		fi
		echo
	fi
}

#build_package $1 $2 "\"$3\""
build_package $1 $2 "$3"