nasm.spec: more cleanups, doc is noarch
[nasm.git] / tools / release
blobdd68ec7cc65c33a4d6a76244d9d2e4b4f5b99d19
1 #!/bin/bash -xe
3 # Generate a NASM release
5 # Usage: release version [destination]
8 version="$1"
9 if [ -z "$1" ]; then
10 echo "Usage: $0 version [destination]" 1>&2
11 exit 1
14 WHERE="$2"
15 if [ -z "$WHERE" ]; then
16 WHERE=/var/tmp
19 if [ -n "$GIT_DIR" ]; then
20 HERE="$GIT_DIR"
21 else
22 HERE=`pwd`
25 if [ x`cat version` != x"${version}" ]; then
26 echo "${version}" > version
27 git update-index version
28 git commit -m "Version ${version}" -- version
30 git tag -m "NASM version ${version}" -f "nasm-${version}"
32 cd "$WHERE"
33 rm -rf nasm-release.*
34 work=nasm-release.$$
35 mkdir $work
36 cd $work
37 unset GIT_DIR
38 git clone -s -l "$HERE" nasm
39 rm -rf nasm/.git nasm/.gitignore
41 # How to invoke make if makej is not set
42 makej="${makej:-make}"
44 # Create files which are in the release but automatically generated
45 cd nasm
46 ./autogen.sh
47 ./configure --prefix=/usr/local
48 $makej perlreq spec manpages
49 $makej alldeps
50 $makej distclean
51 cd ..
53 # Clean up any previous attempt
54 rm -f ../nasm-"$version".tar.gz ../nasm-"$version"-xdoc.tar.gz
55 rm -f ../nasm-"$version".tar.bz2 ../nasm-"$version"-xdoc.tar.bz2
56 rm -f ../nasm-"$version".tar.xz ../nasm-"$version"-xdoc.tar.xz
57 rm -f ../nasm-"$version".zip ../nasm-"$version"-xdoc.zip
59 # Create tarfile (Unix convention: file includes prefix)
60 mv nasm nasm-"$version"
61 tar cvvf nasm-"$version".tar nasm-"$version"
62 xz -9ek nasm-"$version".tar
63 bzip2 -9k nasm-"$version".tar
64 gzip -9 nasm-"$version".tar
65 mv nasm-"$version".tar.gz nasm-"$version".tar.bz2 nasm-"$version".tar.xz ..
67 # Create zipfile (DOS convention: no prefix, convert file endings)
68 cd nasm-"$version"
69 # Text files
70 zip -9Dlr ../../nasm-"$version".zip * -x \*.jpg -x \*.zip -x \*.ico -x \*.png
71 # Binary files
72 zip -9Dgr ../../nasm-"$version".zip * -i \*.jpg -i \*.zip -i \*.ico -i \*.png
73 cd ..
75 # Record what we have already generated
76 find nasm-"$version" -not -type d -print > main
78 # Create documentation
79 cd nasm-"$version"
80 ./configure --prefix=/usr/local
81 $makej doc
82 # Remove intermediate files.
83 $makej cleaner
84 cd ..
86 # Remove non-documentation
87 cat main | xargs rm -f
88 # Delete empty subdirectories
89 find nasm-"$version"/doc -type d -exec rmdir '{}' \; 2>/dev/null || true
91 # Create doc tarfile
92 tar cvvf nasm-"$version"-xdoc.tar nasm-"$version"/doc
93 xz -9ek nasm-"$version"-xdoc.tar
94 bzip2 -9k nasm-"$version"-xdoc.tar
95 gzip -9 nasm-"$version"-xdoc.tar
96 mv nasm-"$version"-xdoc.tar.gz nasm-"$version"-xdoc.tar.bz2 nasm-"$version"-xdoc.tar.xz ..
98 # Create doc zipfile (DOS convention: no prefix, convert file endings)
99 cd nasm-"$version"
100 zip -9Dlr ../../nasm-"$version"-xdoc.zip doc -x \*.pdf -x \*.png
101 zip -9Dgr ../../nasm-"$version"-xdoc.zip doc -i \*.pdf -i \*.png
103 # Clean up
104 cd ../..
105 rm -rf "$work"