Apply Nindent to all .c and .h files
[nasm/avx512.git] / misc / release
blob8b68bafbfd968a0a86e3201f822a2368d40007f5
1 #!/bin/bash -xe
3 # Generate a NASM release
5 # Usage: release {test|real} [branch]
8 if [ -z "$SFUSER" ]; then
9 if [ -f "$HOME/.sfuser" ]; then
10 sfuser=`cat "$HOME/.sfuser"`
11 else
12 sfuser=`whoami`
16 if [ -z "$1" ]; then
17 echo "Usage: $0 {test|real}" 1>&2
18 exit 1
21 if [ "$1" = "real" ]; then
22 real=true
23 else
24 real=false
27 rm -rf nasm-release.*
28 work=`pwd`/nasm-release.$$
29 mkdir "$work"
30 cd "$work"
32 # SF uses a mirror server for anonymous CVS now. Therefore, use a real
33 # identity if we have one; otherwise, change the "true" below to "$real".
34 if true; then
35 # Need to tag the tree, use real account
36 CVS="cvs -z3 -d ${sfuser}@cvs.sourceforge.net:/cvsroot/nasm"
37 else
38 # Don't need to tag the tree, can use anonymous
39 echo ':pserver:anonymous@cvs.nasm.sourceforge.net:/cvsroot/nasm A' > "$work"/cvspass
40 export CVS_PASSFILE="$work"/cvspass
41 CVS="cvs -z3 -d :pserver:anonymous@cvs.nasm.sourceforge.net:/cvsroot/nasm"
44 if [ -n "$2" ]; then
45 branchopt="-r $2"
48 $CVS co $branchopt nasm
49 version=`cat nasm/version`
50 v1=`echo $version | cut -d. -f1`
51 v2=`echo $version | cut -d. -f2`
52 v3=`echo $version | cut -d. -f3`
54 # Tag the tree as a release
55 if $real; then
56 cvstag=nasm-`echo $version | sed -e 's/\./_/g'`
57 # Create the tag for this release
58 ( cd nasm && $CVS tag -F $cvstag )
59 # Update the LATEST tag
60 $CVS rtag -r $cvstag -F -a LATEST nasm
63 # Extract file names which have the -kb flag set, meaning they
64 # are binary files
65 bins="$work"/binaries
66 rm -f "$bins"
67 cd nasm
68 find . -type d -name CVS -print | (
69 while read dir; do
70 xdir=`echo "$dir" | sed -e 's|^\./||' -e 's|/CVS$||'`
71 egrep '^/[^/]*/[^/]*/[^/]*/[^/]*-kb[^/]*/' < $dir/Entries | \
72 cut -d/ -f2 | sed -e "s|^|$xdir/|" >> "$bins"
73 done
75 cd ..
77 # We did "co" instead of "export" -- remove CVS directories
78 find nasm -type d -name CVS -print | xargs rm -rf
80 # Create files which are in the release but automatically generated
81 cd nasm
82 autoheader
83 autoconf
84 ./configure --prefix=/usr/local
85 make dist
86 cd ..
88 # Clean up any previous attempt
89 rm -f ../nasm-${version}.tar.gz ../nasm-${version}-xdoc.tar.gz
90 rm -f ../nasm-${version}.tar.bz2 ../nasm-${version}-xdoc.tar.bz2
91 rm -f ../nasm-${version}.zip ../nasm-${version}-xdoc.zip
93 # Create tarfile (Unix convention: file includes prefix)
94 mv nasm nasm-$version
95 tar cvvf nasm-${version}.tar nasm-${version}
96 bzip2 -9k nasm-${version}.tar
97 gzip -9 nasm-${version}.tar
98 mv nasm-${version}.tar.gz nasm-${version}.tar.bz2 ..
100 # Create zipfile (DOS convention: no prefix, convert file endings)
101 cd nasm-$version
102 zip -9Dlr ../../nasm-${version}.zip -x@"$bins" * # Text files
103 zip -9Dgr ../../nasm-${version}.zip -i@"$bins" * # Binary files
104 cd ..
106 # Record what we have already generated
107 find nasm-$version -not -type d -print > main
109 # Create documentation
110 cd nasm-${version}
111 ./configure --prefix=/usr/local
112 make doc
113 # Remove intermediate files.
114 make cleaner
115 cd ..
117 # Remove non-documentation
118 cat main | xargs rm -f
120 # Create doc tarfile
121 tar cvvf nasm-${version}-xdoc.tar nasm-${version}/doc
122 bzip2 -9k nasm-${version}-xdoc.tar
123 gzip -9 nasm-${version}-xdoc.tar
124 mv nasm-${version}-xdoc.tar.gz nasm-${version}-xdoc.tar.bz2 ..
126 # Create doc zipfile (DOS convention: no prefix, convert file endings)
127 # (Note: generating Win .hlp files requires additional tools)
128 cd nasm-${version}
129 zip -9Dlr ../../nasm-${version}-xdoc.zip doc -x \*.pdf
130 zip -9Dgr ../../nasm-${version}-xdoc.zip doc -i \*.pdf
132 # Clean up
133 cd ..
134 rm -rf "$work"