File: make-dist

package info (click to toggle)
intlfonts 1.2.1-8
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd, squeeze, wheezy
  • size: 59,436 kB
  • ctags: 5
  • sloc: sh: 367; makefile: 186
file content (206 lines) | stat: -rwxr-xr-x 5,712 bytes parent folder | download | duplicates (6)
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
#!/bin/sh

#### make-dist: create an Intlfonts distribution tar file from the current
#### source tree.

prog="$0"

if [ ! -f README -o ! -d European ] ; then
  echo "${prog}: Can't find README file or European subdirectory." >&2
  echo "${prog} must be run in the top directory of the intlfonts" >&2
  echo "distribution tree." >&2
  exit 1
fi

version=`sed -n '1 s/.*International Fonts Ver\.\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*/\1 \2 \3/p' < README`

if [ -z "${version}" ] ; then
  echo "${prog}: Header of README doesn't contain valid version number." >&2
  exit 1
fi

files="README NEWS ChangeLog configure.in configure Makefile.in rmoldfnt.sh install-sh Emacs.ap make-dist"
subdirs="European European.BIG Asian Chinese Chinese.BIG Chinese.X\
	Japanese Japanese.BIG Japanese.X Korean.X Ethiopic Misc\
	TrueType Type1"
sizes="14 16 18 24 32 40 48"

dist=no
tar=no
split=no
diff=no
pack=no

while [ $# -gt 0 ] ; do
  case "$1" in
    ## This option tells make-dist to make the new distribution normally,
    ## This will make a directory, for instance, intlfonts-1.1.
    "--dist" )
      dist=yes
    ;;
    ## This option tells make-dist to make an archive file
    ## (e.g. intlfonts-1.1.tar.gz) of the latest distribution.
    "--arc" )
      arc=yes
    ;;
    ## This option tells make-dist to make an splited archives files
    ## (e.g. intlfonts-1.1-split/Asian.tar.gz) of the latest distribution.
    ## This also enable `--dist'.
    "--split" )
      split=yes
    ;;
    ## This option tells make-dist to make a diff file
    ## (e.g. intlfonts-1.1-1.2.diff) between previous and latest
    ## distributions.
    ## This also enable `--dist'.
    "--diff" )
      diff=yes
    ;;
    ## This option tells make-dist to pack the latest files in this directory
    ## into intlfonts.tar.gz.  This may be useful to move this directory to
    ## some other place.
    ## Note that old versions are not included in the packed file!
    "--pack" )
      pack=yes
    ;;
    * )
      echo "${prog}: Unrecognized argument: $1" >&2
      echo "The valid arguments are --dist, --arc, --diff, and --pack." >&2
      exit 1
    ;;
  esac
  shift
done

if [ "${pack}" = "yes" ] ; then
  echo "Packing the latest files in this directory into intlfonts.tar.gz..."
  mkdir intlfonts
  ln ${files} make-dist README.split intlfonts
  for dir in ${subdirs}; do
    mkdir intlfonts/${dir}
    for file in ${dir}/*; do
      if [ -f ${file} ] ; then
        ln ${file} ${distdir}/${dir}
      fi
    done
  done
  mkdir intlfonts/RCS
  for f in RCS/*; do
    ln ${f} intlfonts/RCS
  done
  tar cfz intlfonts.tar.gz intlfonts
  rm -rf intlfonts
  exit 0
fi

set ${version}
major=$1
minor=$2
release=$3
if [ "x$release" = "x" ] ; then
  version=${major}.${minor}
else
  version=${major}.${minor}.${release}
fi

echo "The latest version is ${version}."

if [ "${dist}" = "no" -a "${arc}" = "no" -a "${diff}" = "no" ] ; then
  echo "${prog}: Specify at least one of --dist, --arc, and --diff." >&2
  exit 1
fi

distdir=intlfonts-${version}

## If the latest distribution directory is not yet created,
## create it for the arguments --arc, --split, and --diff.
if [ ! -d ${distdir} ] ; then
  if [ "${arc}" = "yes" -o "${split}" = "yes" -o "${diff}" = "yes" ] ; then
    dist=yes
  fi
fi

if [ "${dist}" = "yes" ] ; then
  if [ -d ${distdir} ] ; then
    echo "${prog}: Directory ${distdir} already exists." >&2
    exit 1
  fi

  echo "Creating the distribution directory ${distdir}..."

  mkdir ${distdir}
  echo "Linking ${files}..."
  ln ${files} ${distdir}
  for dir in ${subdirs}; do
    echo "Linking ${dir}..."
    mkdir ${distdir}/${dir}
    for file in ${dir}/*; do
      if [ -f ${file} ] ; then
        ln ${file} ${distdir}/${dir}
      fi
    done
#    ln ${dir}/README ${distdir}/${dir}
#    ln ${dir}/*.bdf ${distdir}/${dir}
#    if [ -f ${dir}/fonts.alias ] ; then
#      ln ${dir}/fonts.alias ${distdir}/${dir}
#    fi
  done
fi

if [ "${arc}" = "yes" ] ; then
  echo "Making ${distdir}.tar.gz..."
  
  tar cfz ${distdir}.tar.gz ${distdir}
  echo "Contents of ${distdir}.tar.gz are:"
  tar tfz ${distdir}.tar.gz
  echo "Archive file ${distdir}.tar.gz is ready to be copied to ftp directory."
fi

if [ "${split}" = "yes" ] ; then
  echo "Making splitted archives files under ${distdir}-split..."
  mkdir ${distdir}-split
  cp README.split ${distdir}-split
  for dir in ${subdirs}; do
    echo "Making ${distdir}-split/${dir}.tar.gz..."
    tar cfz ${distdir}-split/${dir}.tar.gz ${distdir}/${dir} \
	`for f in ${files}; do echo ${distdir}/$f; done`
  done
  for size in ${sizes}; do
    echo "Making ${distdir}-split/${size}dots.tar.gz..."
    tar cfz ${distdir}-split/${size}dots.tar.gz ${distdir}/*/*${size}*.bdf \
	`for f in ${files}; do echo ${distdir}/$f; done`
  done
fi

if [ "${diff}" = "yes" ] ; then
  if [ ${minor} = "0" ] ; then
    if [ ${major} = "1" ] ; then
      echo "${prog}:  There is no previous version." >&2
      exit 1
    fi
    prev_major=`expr ${major} - 1`
    # Find the previous greatest minor version.
    prev_minor=0
    for dir in intlfonts-${prev_major}.*; do
      this=`echo ${dir} | sed  's/intlfonts-[0-9][0-9]*\.\([0-9][0-9]*\)/\1/`
      if [ ${this} -gt ${prev_minor} ] ; then prev_minor=${this}; fi
    done
  else
    prev_major=${major}
    prev_minor=`expr ${minor} - 1`
  fi
  prev_version=${prev_major}.${prev_minor}
  prevdir=intlfonts-${prev_version}
  diff_file=intlfonts-${prev_version}-${version}.diff
  echo "Making ${diff_file}..."

  if [ ! -d ${prevdir} ] ; then
    echo "${prog}: Directory ${prevdir} does not exist." >&2
    exit 1
  fi
  
  diff -acrN ${prevdir} ${distdir} > ${diff_file}
fi
    
exit 0
### make-dist ends here