Check-in [b12f77291f]
Overview
Comment:Updated ignores Renamed "work" directory something more meaningful Created teapot_index script to create client-compliant (but bare) repository
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: b12f77291f8164742353d6af581270defc8da862
User & Date: rkeene on 2010-02-05 03:55:55
Other Links: manifest | tags
Context
2010-02-05
03:57
Updated build script to avoid releasing package binary data check-in: 3b36c0ccca user: rkeene tags: trunk
03:55
Updated ignores Renamed "work" directory something more meaningful Created teapot_index script to create client-compliant (but bare) repository check-in: b12f77291f user: rkeene tags: trunk
02:22
Added catchall for platform check-in: 7a3272e8a7 user: rkeene tags: trunk
Changes

Modified .fossil-settings/ignore-glob from [5feb604148] to [f012362875].

1
2
3
4
5
6
7
8
9
10


11
12
client/teapot-client.kit
client/teapot-client.kit/*
server/work/tclpkgs-*.tar.*
server/work/tclpkgs-*.tar.*/*
server/work/tls/build
server/work/tls/build.log
server/work/tls/build.log/*
server/work/tls/build/*
server/work/tls/out
server/work/tls/out/*


server/work/tls/src
server/work/tls/src/*


|
|
|
|
|
|
|
|
>
>
|
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
client/teapot-client.kit
client/teapot-client.kit/*
server/buildpkgs/tclpkgs-*.tar.*
server/buildpkgs/tclpkgs-*.tar.*/*
server/buildpkgs/tls/build
server/buildpkgs/tls/build.log
server/buildpkgs/tls/build.log/*
server/buildpkgs/tls/build/*
server/buildpkgs/tls/out
server/buildpkgs/tls/out/*
server/buildpkgs/tls/src
server/buildpkgs/tls/src/*
server/pkgs
server/pkgs/*

Added server/buildpkgs/Makefile version [f2ece7f06f].













































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
all: tclpkgs-src-current.tar.gz

tclpkgs-src-current.tar.gz: tclpkgs-src-current
	tar -zcf tclpkgs-src-current.tar.gz tclpkgs-src-current
	rm -rf tclpkgs-src-current

tclpkgs-src-current: platform build_all.sh create_teapot */build.sh
	rm -rf tclpkgs-src-current
	mkdir tclpkgs-src-current
	cp -rp platform build_all.sh create_teapot tclpkgs-src-current/
	for dir in */; do \
		if test ! -f "$$dir/build.sh"; then continue; fi; \
		mkdir "tclpkgs-src-current/$$dir"; \
		cp "$$dir/build.sh" "tclpkgs-src-current/$$dir"; \
	done

clean:
	rm -f tclpkgs-*.tar.*
	rm -rf tclpkgs-src-current
	./build_all.sh clean

.PHONY: all clean

Added server/buildpkgs/build_all.sh version [4f07bb6e7e].





















































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
#! /bin/bash

if [ ! -x "./platform" ]; then
	echo 'ERROR: Platform script not found: ./platform' >&2

	exit 1
fi

CLEANONLY=0
DISTCLEAN=0
if [ "$1" = "clean" ]; then
	CLEANONLY=1
fi
if [ "$1" = "distclean" ]; then
	CLEANONLY=1
	DISTCLEAN=1
fi
export CLEANONLY DISTCLEAN

# Determine path to "tclConfig.sh"
TCLCONFIGDIR=$(
	(
		echo "${LD_LIBRARY_PATH}" | tr ':' "\n"
		cat /etc/ld.so.conf 2>/dev/null
		crle 2>/dev/null | grep '^ *Default Library Path' | sed 's@^ *Default Library Path[^:]*:[^:]*/@/@' | tr ':' "\n"
	) | grep '^/' | while read chklibdir; do
		if [ -f "${chklibdir}/tclConfig.sh" ]; then
			echo "${chklibdir}"
			break
		fi
	done
)
if [ -z "${TCLCONFIGDIR}" ]; then
	TCLCONFIGDIR="/usr/lib"
fi
export TCLCONFIGDIR

# Determine platform
PLATFORM="$(./platform)"
export PLATFORM

# Build all appropriate directories
faileddirs=""
for dir in */; do
	export dir

	if [ ! -f "${dir}/build.sh" ]; then
		continue
	fi

	failed=0
	(
		cd "${dir}" || exit 1

		rm -rf "build" "out"
		if [ "${DISTCLEAN}" = "1" ]; then
			rm -rf "src"
		fi
		if [ "${CLEANONLY}" = "1" ]; then
			exit 0
		fi

		mkdir -p "out/${PLATFORM}" >/dev/null 2>/dev/null

		./build.sh 2>&1 | tee "out/${PLATFORM}/build.log" || exit 1
	) || failed=1

	if [ "${failed}" = "1" ]; then
		rm -rf "${dir}/out"
		faileddirs="${faileddirs} ${dir}"
	fi
done

# Cleanup is done at this point
if [ "${CLEANONLY}" = "1" ]; then
	exit 0
fi

# Let the user know what failed to build
if [ -n "${faileddirs}" ]; then
	echo "The following failed to build:${failddirs}"
fi

# Create tarfile of built packages
PLATFORM="$(./platform)"
DATECODE="$(date +%Y%m%d%H%M)"
OUTFILEBASE="tclpkgs-${PLATFORM}-${DATECODE}"
tar -cf - */out | bzip2 -9c > "${OUTFILEBASE}.tar.bz2"

exit 0

Added server/buildpkgs/create_teapot version [7fbee19e66].









































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
#! /bin/bash

OUTFILE="$1"
PKG="$2"
PKGVER="$3"
SRCURL="$4"
PLATFORM="$5"
REQS="$6"
DESC="$7"
TMPFILE="${TMPDIR:-/tmp}/reqfile-$$${RANDOM}${RANDOM}${RANDOM}"
export OUTFILE PKG PKGVER SRCURL PLATFORM REQS DESC TMPFILE

VALIDSYNTAX=1
if [ -z "${OUTFILE}" ]; then
	echo 'ERROR: Output not specified' >&2
	VALIDSYNTAX=0
fi
if [ -z "${PKG}" ]; then
	echo 'ERROR: Package not specified' >&2
	VALIDSYNTAX=0
fi
if [ -z "${PKGVER}" ]; then
	echo 'ERROR: Package version not specified' >&2
	VALIDSYNTAX=0
fi
if [ -z "${PLATFORM}" ]; then
	echo 'ERROR: Platform not specified' >&2
	VALIDSYNTAX=0
fi
if [ -z "${DESC}" ]; then
	echo 'ERROR: Description not specified' >&2
	VALIDSYNTAX=0
fi
if [ "${VALIDSYNTAX}" = "0" ]; then
	echo 'Usage: create_teapot <output> <pkg> <pkgver> <srcurl> <platform> <reqs> <desc>' >&2
	exit 1
fi

OUTSHORT=$(echo "${OUTFILE}" | sed 's@^.*/@@')
TEXTFILE=0
if [ "${OUTSHORT}" = "teapot.txt" ]; then
	TEXTFILE=1
fi
if [ ! -e "${OUTFILE}" ]; then
	TEXTFILE=1
fi

rm -f "${TMPFILE}"
cat << __EOF__ > "${TMPFILE}"
Package ${PKG} ${PKGVER}
Meta platform           ${PLATFORM}
Meta rsk::build::date   $(date +%Y-%m-%d)
Meta description        ${DESC}
__EOF__
echo "${REQS}" | tr ',' "\n" | while read req; do
	req="$(echo "${req}" | sed 's@^ *@@;s@ *$@@')"
	if [ -z "${req}" ]; then
		continue
	fi

	if echo "${req}" | grep ' ' >/dev/null; then
		req="{${req}}"
	fi

	echo "Meta require            ${req}" >> "${TMPFILE}"
done

if [ "${TEXTFILE}" = "1" ]; then
	cat "${TMPFILE}" > "${OUTFILE}"
else
	(
		head -1 "${OUTFILE}"
		echo ''
		echo '# @@ Meta Begin'
		sed 's@^@# @' "${TMPFILE}"
		echo '# @@ Meta End'
		echo ''
		tail +2 "${OUTFILE}"
	) > "${OUTFILE}.new"
	cat "${OUTFILE}.new" > "${OUTFILE}"
	rm -f "${OUTFILE}.new"
fi

rm -f "${TMPFILE}"

Added server/buildpkgs/platform version [828b4fc7e9].



















































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
#! /bin/bash

case "`uname -s`" in
	Linux)
		GLIBCVERS=$(strings /lib/libc.so.6 | grep '^GLIBC_[0-9][0-9]*\.[0-9]*' | cut -f 2- -d _ | cut -f 1-2 -d . | sed 's@\.@ @g' |  sort -n +0 +1 | tail -1 | sed 's@ @\.@g')

		case "`uname -m`" in
			i?86)
				CPUPLAT="ix86"
				;;
			sun4?)
				CPUPLAT="sparc"
				;;
			*)
				CPUPLAT="`uname -m`"
				;;
		esac

		echo "linux-glibc${GLIBCVERS}-${CPUPLAT}"
		;;
	SunOS)
		SUNMAJVER=$(uname -r | cut -f 1 -d .)
		SUNMINVER=$(uname -r | cut -f 2 -d .)
		SOLVER="$[${SUNMAJVER} - 3].${SUNMINVER}"


		case "`uname -m`" in
			sun4?)
				CPUPLAT="sparc"
				;;
			*)
				CPUPLAT="ix86"
				;;
		esac

		echo "solaris${SOLVER}-${CPUPLAT}"
		;;
	*)
		echo "`uname -s | dd conv=lcase 2>/dev/null`-`uname -m | dd conv=lcase 2>/dev/null`"
		;;
esac

Added server/buildpkgs/tls/build.sh version [d44be617e2].

















































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
#! /bin/bash

if [ ! -x "../platform" ]; then
	echo "No platform script found, aborting." >&2

	exit 1
fi

VERS=1.6
SRC="src/tls${VERS}-src.tar.gz"
SRCURL="http://sourceforge.net/projects/tls/files/tls/${VERS}/tls${VERS}-src.tar.gz/download"
BUILDDIR="tls${VERS}"
WORKDIR="${TMPDIR:-/tmp}/tls-$$${RANDOM}${RANDOM}${RANDOM}"
PLATFORM="$(../platform)"
PLATDIR="out/${PLATFORM}"

export VERS SRC SRCURL BUILDDIR WORKDIR PLATFORM PLATDIR

if [ ! -f "${SRC}" ]; then
	mkdir src >/dev/null 2>/dev/null

	wget -O "${SRC}" "${SRCURL}" || exit 1
fi

(
	rm -rf build
	mkdir build
	cd build/ || exit 1

	gzip -dc "../${SRC}" | tar -xf -
	cd "${BUILDDIR}" || exit 1

	for chkssldir in $(pkg-config openssl --cflags | sed 's@ *-I *@|@g' | tr '|' "\n" | grep '^/'); do
		if [ -f "${chkssldir}/openssl/opensslv.h" -o -f "${chkssldir}/opensslv.h" ]; then
			SSLDIR=$(echo "${chkssldir}" | sed 's@/[^/]*/*$@@')
		fi
	done
	if [ -z "${SSLDIR}" ]; then
		SSLDIR="/usr"
	fi

	./configure --enable-shared --with-tcl="${TCLCONFIGDIR}" --with-ssl-dir="${SSLDIR}"
	gmake || exit 1
) || exit 1

(
	mkdir -p "${PLATDIR}" >/dev/null 2>/dev/null

	cp "build/${BUILDDIR}/libtls1.6.so" "${PLATDIR}/"
	cp "build/${BUILDDIR}/pkgIndex.tcl" "${PLATDIR}/"
	cp "build/${BUILDDIR}/tls.tcl" "${PLATDIR}/"

	../create_teapot "${PLATDIR}/teapot.txt" "tls" "${VERS}" "${SRCURL}" "${PLATFORM}" "Tcl 8.4" "SSL TLS Secure Sockets"
) || exit 1

exit 0

Added server/teapot_index version [07d237bd6c].



















































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
#! /usr/bin/env tclsh

if {[llength $argv] != "2"} {
	puts stderr "Usage: teapot_index <srcdir> <destdir>"
	exit 1
}

set srcdir [file normalize [lindex $argv 0]]
set dstdir [file normalize [lindex $argv 1]]

# Index all packages
proc teapot_index {srcdir} {
	array set pkginfo [list]

	foreach pkgdir [glob -directory $srcdir -type d */out/*] {
		unset -nocomplain currpkginfo
		set currpkginfo(pkgdir) $pkgdir

		set teapot [file join $pkgdir teapot.txt]

		set multifile 1
		if {![file exists $teapot]} {
			set files [glob -directory $pkgdir *]
			if {[llength $files] == 1} {
				set teapot [lindex $files 0]
				set multifile 0
			} else {
				continue
			}
		}

		set currpkginfo(multifile) $multifile
		if {$multifile} {
			set currpkginfo(extfile) file.zip
		} else {
			set currpkginfo(extfile) file.tm
		}

		set fd [open $teapot r]
		set data [read $fd]
		close $fd

		set processline $multifile
		foreach line [split $data \n] {
			set line [string trim $line]
			if {!$multifile} {
				if {$line == "# @@ Meta Begin"} {
					set processline 1
					continue
				}

				if {$line == "# @@ Meta End"} {
					break
				}

				set line [regsub {^ *# *} $line {}]
			}

			if {!$processline} {
				continue
			}

			set cmd "INVALID"
			catch {
				set cmd [string toupper [lindex $line 0]]
			}

			switch -- $cmd {
				"PACKAGE" {
					set name [lindex $line 1]
					set vers [lindex $line 2]

					set currpkginfo(name) $name
					set currpkginfo(vers) $vers
				}
				"META" {
					set var [string tolower [lindex $line 1]]
					set val [lrange $line 2 end]

					set currpkginfo($var) $val
				}
			}
		}

		set pkginfo([list $currpkginfo(name) $currpkginfo(vers) $currpkginfo(platform)]) [array get currpkginfo]
	}

	return [array get pkginfo]
}

proc generate_tpm {entlist} {
	set ret {<!-- [[TPM[[}
	append ret $entlist
	append ret {]]MPT]] -->}

	return $ret
}

proc generate_table {fields numitems} {
	set ret ""

	foreach field $fields {
		append ret "      <tr>\n"

		foreach part [lrange $field 0 [expr $numitems - 1]] {
			append ret "        <td>$part</td>\n"
		}

		append ret "      </tr>\n"
	}

	return [string range $ret 0 end-1]
}

# Create "index.html"
proc create_output_index {dstdir pkginfo_arrlist} {
	array set pkginfo $pkginfo_arrlist

	set indexfile [file join $dstdir index.html]

	set pkglist [list]
	foreach ent [array names pkginfo] {
		set pkg [lindex $ent 0]
		if {[lsearch -exact $pkglist $pkg] != -1} {
			continue
		}

		lappend pkglist $pkg
	}

	set fd [open $indexfile w]
	puts $fd "<html>"
	puts $fd "  <head>"
	puts $fd "    <title>List of all entities</title>"
	puts $fd "  </head>"
	puts $fd "  <body>"
	puts $fd [generate_tpm $pkglist]
	puts $fd "    <h1>List of all entities</h1>"
	puts $fd "    <table>"
	puts $fd [generate_table $pkglist 1]
	puts $fd "    </table>"
	puts $fd "  </body>"
	puts $fd "</html>"
	close $fd
}

# Create "package/list"
proc create_output_pkglist {dstdir pkginfo_arrlist} {
	array set pkginfo $pkginfo_arrlist

	set pkgdir [file join $dstdir package]
	catch {
		file mkdir $pkgdir
	}
	set indexfile [file join $pkgdir list.html]
	set altindexfile [file join $pkgdir list]

	set pkglist [list]
	foreach ent [array names pkginfo] {
		set pkg [lindex $ent 0]
		set ver [lindex $ent 1]
		set arch [lindex $ent 2]

		lappend pkglist [list package $pkg $ver $arch 0]
	}

	set fd [open $indexfile w]
	puts $fd "<html>"
	puts $fd "  <head>"
	puts $fd "    <title>List of all packages</title>"
	puts $fd "  </head>"
	puts $fd "  <body>"
	puts $fd [generate_tpm $pkglist]
	puts $fd "    <h1>List of all packages</h1>"
	puts $fd "    <table>"
	puts $fd "      <tr>"
	puts $fd "        <th>What</th>"
	puts $fd "        <th>Name</th>"
	puts $fd "        <th>Version</th>"
	puts $fd "        <th>Platform</th>"
	puts $fd "      </tr>"
	puts $fd [generate_table $pkglist 4]
	puts $fd "    </table>"
	puts $fd "  </body>"
	puts $fd "</html>"
	close $fd

	file delete $altindexfile
	file link -hard $altindexfile $indexfile
}

# Create "package/name/<pkg>/ver/<ver>/arch/<arch>/file"
proc create_output_files {dstdir pkginfo_arrlist} {
	array set pkginfo $pkginfo_arrlist

	foreach ent [array names pkginfo] {
		set pkg [lindex $ent 0]
		set ver [lindex $ent 1]
		set arch [lindex $ent 2]

		array set currpkginfo $pkginfo($ent)
		set pkgdir $currpkginfo(pkgdir)
		set multifile $currpkginfo(multifile)
		set extfiletail $currpkginfo(extfile)

		set workdir [file join $dstdir package name $pkg ver $ver arch $arch]
		set regfile [file join $workdir file]
		set extfile [file join $workdir $extfiletail]
		catch {
			file mkdir $workdir
		}

		if {$multifile} {
			catch {
				cd $pkgdir

				exec zip -r $extfile .
			}
		} else {
			set origfile [lindex [glob $pkgdir *] 0]

			file copy -force -- $origfile $extfile
		}

		file delete $regfile
		file link -hard $regfile $extfile
	}
}

set pkginfo [teapot_index $srcdir]
create_output_index $dstdir $pkginfo
create_output_pkglist $dstdir $pkginfo
create_output_files $dstdir $pkginfo

Deleted server/work/Makefile version [f2ece7f06f].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
all: tclpkgs-src-current.tar.gz

tclpkgs-src-current.tar.gz: tclpkgs-src-current
	tar -zcf tclpkgs-src-current.tar.gz tclpkgs-src-current
	rm -rf tclpkgs-src-current

tclpkgs-src-current: platform build_all.sh create_teapot */build.sh
	rm -rf tclpkgs-src-current
	mkdir tclpkgs-src-current
	cp -rp platform build_all.sh create_teapot tclpkgs-src-current/
	for dir in */; do \
		if test ! -f "$$dir/build.sh"; then continue; fi; \
		mkdir "tclpkgs-src-current/$$dir"; \
		cp "$$dir/build.sh" "tclpkgs-src-current/$$dir"; \
	done

clean:
	rm -f tclpkgs-*.tar.*
	rm -rf tclpkgs-src-current
	./build_all.sh clean

.PHONY: all clean
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<












































Deleted server/work/build_all.sh version [4f07bb6e7e].

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
#! /bin/bash

if [ ! -x "./platform" ]; then
	echo 'ERROR: Platform script not found: ./platform' >&2

	exit 1
fi

CLEANONLY=0
DISTCLEAN=0
if [ "$1" = "clean" ]; then
	CLEANONLY=1
fi
if [ "$1" = "distclean" ]; then
	CLEANONLY=1
	DISTCLEAN=1
fi
export CLEANONLY DISTCLEAN

# Determine path to "tclConfig.sh"
TCLCONFIGDIR=$(
	(
		echo "${LD_LIBRARY_PATH}" | tr ':' "\n"
		cat /etc/ld.so.conf 2>/dev/null
		crle 2>/dev/null | grep '^ *Default Library Path' | sed 's@^ *Default Library Path[^:]*:[^:]*/@/@' | tr ':' "\n"
	) | grep '^/' | while read chklibdir; do
		if [ -f "${chklibdir}/tclConfig.sh" ]; then
			echo "${chklibdir}"
			break
		fi
	done
)
if [ -z "${TCLCONFIGDIR}" ]; then
	TCLCONFIGDIR="/usr/lib"
fi
export TCLCONFIGDIR

# Determine platform
PLATFORM="$(./platform)"
export PLATFORM

# Build all appropriate directories
faileddirs=""
for dir in */; do
	export dir

	if [ ! -f "${dir}/build.sh" ]; then
		continue
	fi

	failed=0
	(
		cd "${dir}" || exit 1

		rm -rf "build" "out"
		if [ "${DISTCLEAN}" = "1" ]; then
			rm -rf "src"
		fi
		if [ "${CLEANONLY}" = "1" ]; then
			exit 0
		fi

		mkdir -p "out/${PLATFORM}" >/dev/null 2>/dev/null

		./build.sh 2>&1 | tee "out/${PLATFORM}/build.log" || exit 1
	) || failed=1

	if [ "${failed}" = "1" ]; then
		rm -rf "${dir}/out"
		faileddirs="${faileddirs} ${dir}"
	fi
done

# Cleanup is done at this point
if [ "${CLEANONLY}" = "1" ]; then
	exit 0
fi

# Let the user know what failed to build
if [ -n "${faileddirs}" ]; then
	echo "The following failed to build:${failddirs}"
fi

# Create tarfile of built packages
PLATFORM="$(./platform)"
DATECODE="$(date +%Y%m%d%H%M)"
OUTFILEBASE="tclpkgs-${PLATFORM}-${DATECODE}"
tar -cf - */out | bzip2 -9c > "${OUTFILEBASE}.tar.bz2"

exit 0
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




















































































































































































Deleted server/work/create_teapot version [7fbee19e66].

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
#! /bin/bash

OUTFILE="$1"
PKG="$2"
PKGVER="$3"
SRCURL="$4"
PLATFORM="$5"
REQS="$6"
DESC="$7"
TMPFILE="${TMPDIR:-/tmp}/reqfile-$$${RANDOM}${RANDOM}${RANDOM}"
export OUTFILE PKG PKGVER SRCURL PLATFORM REQS DESC TMPFILE

VALIDSYNTAX=1
if [ -z "${OUTFILE}" ]; then
	echo 'ERROR: Output not specified' >&2
	VALIDSYNTAX=0
fi
if [ -z "${PKG}" ]; then
	echo 'ERROR: Package not specified' >&2
	VALIDSYNTAX=0
fi
if [ -z "${PKGVER}" ]; then
	echo 'ERROR: Package version not specified' >&2
	VALIDSYNTAX=0
fi
if [ -z "${PLATFORM}" ]; then
	echo 'ERROR: Platform not specified' >&2
	VALIDSYNTAX=0
fi
if [ -z "${DESC}" ]; then
	echo 'ERROR: Description not specified' >&2
	VALIDSYNTAX=0
fi
if [ "${VALIDSYNTAX}" = "0" ]; then
	echo 'Usage: create_teapot <output> <pkg> <pkgver> <srcurl> <platform> <reqs> <desc>' >&2
	exit 1
fi

OUTSHORT=$(echo "${OUTFILE}" | sed 's@^.*/@@')
TEXTFILE=0
if [ "${OUTSHORT}" = "teapot.txt" ]; then
	TEXTFILE=1
fi
if [ ! -e "${OUTFILE}" ]; then
	TEXTFILE=1
fi

rm -f "${TMPFILE}"
cat << __EOF__ > "${TMPFILE}"
Package ${PKG} ${PKGVER}
Meta platform           ${PLATFORM}
Meta rsk::build::date   $(date +%Y-%m-%d)
Meta description        ${DESC}
__EOF__
echo "${REQS}" | tr ',' "\n" | while read req; do
	req="$(echo "${req}" | sed 's@^ *@@;s@ *$@@')"
	if [ -z "${req}" ]; then
		continue
	fi

	if echo "${req}" | grep ' ' >/dev/null; then
		req="{${req}}"
	fi

	echo "Meta require            ${req}" >> "${TMPFILE}"
done

if [ "${TEXTFILE}" = "1" ]; then
	cat "${TMPFILE}" > "${OUTFILE}"
else
	(
		head -1 "${OUTFILE}"
		echo ''
		echo '# @@ Meta Begin'
		sed 's@^@# @' "${TMPFILE}"
		echo '# @@ Meta End'
		echo ''
		tail +2 "${OUTFILE}"
	) > "${OUTFILE}.new"
	cat "${OUTFILE}.new" > "${OUTFILE}"
	rm -f "${OUTFILE}.new"
fi

rm -f "${TMPFILE}"
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<








































































































































































Deleted server/work/platform version [828b4fc7e9].

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
#! /bin/bash

case "`uname -s`" in
	Linux)
		GLIBCVERS=$(strings /lib/libc.so.6 | grep '^GLIBC_[0-9][0-9]*\.[0-9]*' | cut -f 2- -d _ | cut -f 1-2 -d . | sed 's@\.@ @g' |  sort -n +0 +1 | tail -1 | sed 's@ @\.@g')

		case "`uname -m`" in
			i?86)
				CPUPLAT="ix86"
				;;
			sun4?)
				CPUPLAT="sparc"
				;;
			*)
				CPUPLAT="`uname -m`"
				;;
		esac

		echo "linux-glibc${GLIBCVERS}-${CPUPLAT}"
		;;
	SunOS)
		SUNMAJVER=$(uname -r | cut -f 1 -d .)
		SUNMINVER=$(uname -r | cut -f 2 -d .)
		SOLVER="$[${SUNMAJVER} - 3].${SUNMINVER}"


		case "`uname -m`" in
			sun4?)
				CPUPLAT="sparc"
				;;
			*)
				CPUPLAT="ix86"
				;;
		esac

		echo "solaris${SOLVER}-${CPUPLAT}"
		;;
	*)
		echo "`uname -s | dd conv=lcase 2>/dev/null`-`uname -m | dd conv=lcase 2>/dev/null`"
		;;
esac
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


















































































Deleted server/work/tls/build.sh version [d44be617e2].

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
#! /bin/bash

if [ ! -x "../platform" ]; then
	echo "No platform script found, aborting." >&2

	exit 1
fi

VERS=1.6
SRC="src/tls${VERS}-src.tar.gz"
SRCURL="http://sourceforge.net/projects/tls/files/tls/${VERS}/tls${VERS}-src.tar.gz/download"
BUILDDIR="tls${VERS}"
WORKDIR="${TMPDIR:-/tmp}/tls-$$${RANDOM}${RANDOM}${RANDOM}"
PLATFORM="$(../platform)"
PLATDIR="out/${PLATFORM}"

export VERS SRC SRCURL BUILDDIR WORKDIR PLATFORM PLATDIR

if [ ! -f "${SRC}" ]; then
	mkdir src >/dev/null 2>/dev/null

	wget -O "${SRC}" "${SRCURL}" || exit 1
fi

(
	rm -rf build
	mkdir build
	cd build/ || exit 1

	gzip -dc "../${SRC}" | tar -xf -
	cd "${BUILDDIR}" || exit 1

	for chkssldir in $(pkg-config openssl --cflags | sed 's@ *-I *@|@g' | tr '|' "\n" | grep '^/'); do
		if [ -f "${chkssldir}/openssl/opensslv.h" -o -f "${chkssldir}/opensslv.h" ]; then
			SSLDIR=$(echo "${chkssldir}" | sed 's@/[^/]*/*$@@')
		fi
	done
	if [ -z "${SSLDIR}" ]; then
		SSLDIR="/usr"
	fi

	./configure --enable-shared --with-tcl="${TCLCONFIGDIR}" --with-ssl-dir="${SSLDIR}"
	gmake || exit 1
) || exit 1

(
	mkdir -p "${PLATDIR}" >/dev/null 2>/dev/null

	cp "build/${BUILDDIR}/libtls1.6.so" "${PLATDIR}/"
	cp "build/${BUILDDIR}/pkgIndex.tcl" "${PLATDIR}/"
	cp "build/${BUILDDIR}/tls.tcl" "${PLATDIR}/"

	../create_teapot "${PLATDIR}/teapot.txt" "tls" "${VERS}" "${SRCURL}" "${PLATFORM}" "Tcl 8.4" "SSL TLS Secure Sockets"
) || exit 1

exit 0
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<