summaryrefslogtreecommitdiff
path: root/dist.sh
blob: f25ca6741be7acd69adbbd0ca2fc4ffd47cec926 (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
#! /usr/bin/env bash

# Create XSD/e distribution.
#
# -test
# -j <jobs>
#

trap 'exit 1' ERR

function error ()
{
  echo "$*" 1>&2
}

test=n
jobs=22

while [ $# -gt 0 ]; do
  case $1 in
    -test)
      test=y
      shift
      ;;
    -j)
      shift
      jobs=$1
      shift
      ;;
    *)
      error "unknown option: $1"
      exit 1
      ;;
  esac
done

v=`cat xsde/version`
bv=`cat ../build/build/version`
cv=`cat ../cutl/libcutl/version.txt`
xfv=`cat libxsd-frontend/version.txt`

echo "packaging xsde-$v"
echo "EVERYTHING MUST BE COMMITTED!"

# prepare xsde-x.y.z
#
rm -rf xsde-$v
mkdir xsde-$v
cd xsde
git archive master | tar -x -C ../xsde-$v
cd ..
rm -f xsde-$v/.gitignore

# Copy generated documentation.
#
cd xsde/doc
make -j $jobs

files="xsde.1 xsde.xhtml cxx/parser/guide/cxx-parser-e-guide.* cxx/serializer/guide/cxx-serializer-e-guide.* cxx/hybrid/guide/cxx-hybrid-e-guide.*"

for f in $files; do
  rsync -aq $f ../../xsde-$v/doc/$f
  touch ../../xsde-$v/doc/$f
done

cd ../..

# Copy generated source files.
#
cd xsde/xsde
make -j $jobs

files="options.?xx cxx/options.?xx cxx/parser/options.?xx cxx/serializer/options.?xx cxx/hybrid/options.?xx"

for f in $files; do
  rsync -aq $f ../../xsde-$v/xsde/$f
  touch ../../xsde-$v/xsde/$f
done

cd ../..

# prepare xsde-x.y.z+dep
#
rm -rf xsde-$v+dep
mkdir xsde-$v+dep
cd xsde+dep
git archive master | tar -x -C ../xsde-$v+dep
cd ../xsde-$v+dep
rm -f .gitignore
rsync -aq --copy-unsafe-links ../xsde-$v/ xsde/
cd ..

# Copy libcult
#
rsync -aq --copy-unsafe-links ../cutl/libcutl-$cv/ xsde-$v+dep/libcutl/

# Copy libxsd-fe
#
rsync -aq --copy-unsafe-links libxsd-frontend-$xfv/ xsde-$v+dep/libxsd-frontend/

# Install build
#
make -C ../build/build-$bv install_inc_dir=`pwd`/xsde-$v+dep install

# Test the dep pack.
#
if [ $test = y ]; then
  rm -rf xsde-$v+dep.test
  rsync -aq --copy-unsafe-links xsde-$v+dep/ xsde-$v+dep.test/
  cd xsde-$v+dep.test
  make -j $jobs test
  cd ..
  rm -r xsde-$v+dep.test
fi

# Package
#
tar cfj xsde-$v.tar.bz2 xsde-$v
tar cfj xsde-$v+dep.tar.bz2 xsde-$v+dep

sha1sum xsde-$v.tar.bz2 >xsde-$v.tar.bz2.sha1
sha1sum xsde-$v+dep.tar.bz2 >xsde-$v+dep.tar.bz2.sha1