Debian Codegraph @

tools/release

raw
1 #!/bin/bash -xe
2 #
3 # Generate a NASM release
4 #
5 # Usage: release version [destination]
6 #
7
8 version="$1"
9 if [ -z "$1" ]; then
10 echo "Usage: $0 version [destination]" 1>&2
11 exit 1
12 fi
13
14 WHERE="$2"
15 if [ -z "$WHERE" ]; then
16 WHERE=/var/tmp
17 fi
18
19 if [ -n "$GIT_DIR" ]; then
20 HERE="$GIT_DIR"
21 else
22 HERE=`pwd`
23 fi
24
25 unset ACLOCAL_PATH
26
27 if [ x`cat version` != x"${version}" ]; then
28 echo "${version}" > version
29 git update-index version
30 git commit -m "Version ${version}" -- version
31 fi
32 git tag -m "NASM version ${version}" -f "nasm-${version}"
33
34 cd "$WHERE"
35 rm -rf nasm-release.*
36 work=nasm-release.$$
37 mkdir $work
38 cd $work
39 unset GIT_DIR
40 git clone -s -l "$HERE" nasm
41 rm -rf nasm/.git nasm/.gitignore
42
43 # How to invoke make if makej is not set
44 makej="${makej:-make}"
45
46 # Create files which are in the release but automatically generated
47 cd nasm
48 ./autogen.sh --clearenv
49 ./configure --prefix=/usr/local
50 $makej dist
51 cd ..
52
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
58
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 ..
66
67 # Create zipfile (DOS convention: no prefix, convert file endings)
68 cd nasm-"$version"
69 binext='jpg zip ico png pdf bin o obj exe com a lib xz'
70 for e in $binext; do
71 xbin="$xbin -x *.$e -x *.$e.t"
72 ibin="$ibin -i *.$e -i *.$e.t"
73 done
74 # Text files
75 zip -9Dlr ../../nasm-"$version".zip * $xbin
76 # Binary files
77 zip -9Dgr ../../nasm-"$version".zip * $ibin
78 cd ..
79
80 # Record what we have already generated
81 find nasm-"$version" -not -type d -print > main
82
83 # Create documentation
84 cd nasm-"$version"
85 ./configure --prefix=/usr/local
86 $makej doc
87 # Remove intermediate files.
88 $makej cleaner
89 cd ..
90
91 # Remove non-documentation
92 cat main | xargs rm -f
93 # Delete empty subdirectories
94 find nasm-"$version"/doc -type d -exec rmdir '{}' \; 2>/dev/null || true
95
96 # Create doc tarfile (don't include nasmdoc.pdf.xz as it is redundant)
97 rm -f nasm-"$version"/doc/*.pdf.xz
98 tar cvvf nasm-"$version"-xdoc.tar nasm-"$version"/doc
99 xz -9ek nasm-"$version"-xdoc.tar
100 bzip2 -9k nasm-"$version"-xdoc.tar
101 gzip -9 nasm-"$version"-xdoc.tar
102 mv nasm-"$version"-xdoc.tar.gz nasm-"$version"-xdoc.tar.bz2 nasm-"$version"-xdoc.tar.xz ..
103
104 # Create doc zipfile (DOS convention: no prefix, convert file endings)
105 cd nasm-"$version"
106 zip -9Dlr ../../nasm-"$version"-xdoc.zip doc $xbin
107 zip -9Dgr ../../nasm-"$version"-xdoc.zip doc $ibin
108
109 # Clean up
110 cd ../..
111 rm -rf "$work"