summaryrefslogtreecommitdiff
path: root/misc/release
blob: 83465ce19285d9a1031f74628f7183b7facb752e (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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#!/bin/bash -xe
#
# Generate a NASM release
#
# Usage: release {test|real} [branch]
#

if [ -z "$SFUSER" ]; then
  if [ -f "$HOME/.sfuser" ]; then
    sfuser=`cat "$HOME/.sfuser"`
  else
    sfuser=`whoami`
  fi
fi

if [ -z "$1" ]; then
  echo "Usage: $0 {test|real}" 1>&2
  exit 1
fi

if [ "$1" = "real" ]; then
  real=true
else
  real=false
fi

rm -rf nasm-release.*
work=`pwd`/nasm-release.$$
mkdir "$work"
cd "$work"

if $real; then
  # Need to tag the tree, use real account
  CVS="cvs -z3 -d ${sfuser}@cvs.nasm.sourceforge.net:/cvsroot/nasm"
else
  # Don't need to tag the tree, can use anonymous
  echo ':pserver:anonymous@cvs.nasm.sourceforge.net:/cvsroot/nasm A' > "$work"/cvspass
  export CVS_PASSFILE="$work"/cvspass
  CVS="cvs -z3 -d :pserver:anonymous@cvs.nasm.sourceforge.net:/cvsroot/nasm"
fi

if [ -n "$2" ]; then
  branchopt="-r $2"
fi

$CVS co $branchopt nasm
version=`cat nasm/version`
v1=`echo $version | cut -d. -f1`
v2=`echo $version | cut -d. -f2`
v3=`echo $version | cut -d. -f3`

# Tag the tree as a release
if $real; then
  cvstag=nasm-`echo $version | sed -e 's/\./_/g'`
  # Create the tag for this release
  ( cd nasm && $CVS tag -F $cvstag )
  # Update the LATEST tag
  $CVS rtag -r $cvstag -F -a LATEST nasm
fi

# Extract file names which have the -kb flag set, meaning they
# are binary files
bins="$work"/binaries
rm -f "$bins"
cd nasm
find . -type d -name CVS -print | (
    while read dir; do
       xdir=`echo "$dir" | sed -e 's|^\./||' -e 's|/CVS$||'`
       egrep '^/[^/]*/[^/]*/[^/]*/[^/]*-kb[^/]*/' < $dir/Entries | \
	   cut -d/ -f2 | sed -e "s|^|$xdir/|" >> "$bins"
    done
)
cd ..

# We did "co" instead of "export" -- remove CVS directories
find nasm -type d -name CVS -print | xargs rm -rf

# Create files which are in the release but automatically generated
cd nasm
autoconf
./configure --prefix=/usr/local
make dist
cd ..

# Clean up any previous attempt
rm -f ../nasm-${version}.tar.gz  ../nasm-${version}-xdoc.tar.gz
rm -f ../nasm-${version}.tar.bz2 ../nasm-${version}-xdoc.tar.bz2
rm -f ../nasm-${version}.zip     ../nasm-${version}-xdoc.zip

# Create tarfile (Unix convention: file includes prefix)
mv nasm nasm-$version
tar cvvf  nasm-${version}.tar nasm-${version}
bzip2 -9k nasm-${version}.tar
gzip -9   nasm-${version}.tar
mv nasm-${version}.tar.gz nasm-${version}.tar.bz2 ..

# Create zipfile (DOS convention: no prefix, convert file endings)
cd nasm-$version
zip -9Dlr ../../nasm-${version}.zip -x@"$bins" *	# Text files
zip -9Dgr ../../nasm-${version}.zip -i@"$bins" *	# Binary files
cd ..

# Record what we have already generated
find nasm-$version -not -type d -print > main

# Create documentation
make doc
# Remove intermediate files.
make cleaner
cd ..

# Remove non-documentation
cat main | xargs rm -f

# Create doc tarfile
tar cvvf nasm-${version}-xdoc.tar nasm-${version}/doc
bzip2 -9k nasm-${version}-xdoc.tar
gzip -9   nasm-${version}-xdoc.tar
mv nasm-${version}-xdoc.tar.gz nasm-${version}-xdoc.tar.bz2 ..

# Create doc zipfile (DOS convention: no prefix, convert file endings)
# (Note: generating Win .hlp files requires additional tools)
cd nasm-${version}
zip -9Dlr ../../nasm-${version}-xdoc.zip doc -x \*.pdf
zip -9Dgr ../../nasm-${version}-xdoc.zip doc -i \*.pdf

# Clean up
cd ..
rm -rf "$work"