]> git.lyx.org Git - wiki-uploads.git/blob - tex2lyx/make_tex2lyx_dist.sh
Add memoir-makeindex module and script
[wiki-uploads.git] / tex2lyx / make_tex2lyx_dist.sh
1 #! /bin/sh
2
3 usage() {
4     test $# -ge 1 && SCRIPT=`basename "$1"`
5     shift
6     echo "Usage: $SCRIPT <LyX source directory>" >&2
7     echo $* >&2
8     exit 1
9 }
10
11 # It appears that this environment variable is not defined on Sun,
12 # so just define it.
13 PWD=`pwd`
14
15 # document the created archive name
16 KERNEL=`uname -s`
17 echo "$KERNEL" | grep MINGW >/dev/null && KERNEL=win32
18 ARCH=`uname -p`
19
20 ARCHIVEBASE="tex2lyx_${KERNEL}_${ARCH}_"`date +%d%b%y`
21
22
23 test $# -eq 1 || usage "$0"
24 cd "$1" ||  usage "$0"
25 ./autogen.sh || usage "$0" "autogen.sh failed"
26
27 BUILDDIR=build-tex2lyx
28 test -d "$BUILDDIR" || {
29     mkdir "$BUILDDIR" || usage "$0" "mkdir $BUILDDIR failed"
30 }
31
32 cd "$BUILDDIR" || usage "$0" "cd $BUILDDIR failed"
33
34 INSTALLDIR=LyX-1.4
35 CONFIGURE="../configure --disable-debug --enable-optimization --prefix='$PWD/$INSTALLDIR' --with-frontend=foo"
36 echo $CONFIGURE
37 eval "${CONFIGURE}" || usage "$0" "configure failed"
38
39 (cd boost && make) || usage "$0" "make in boost failed"
40 (cd src/support && make) || usage "$0" "make in src/support failed"
41 (cd src/tex2lyx && make) || usage "$0" "make in src/tex2lyx failed"
42 (cd src/tex2lyx && make install) || usage "$0" "make install in src/tex2lyx failed"
43 (cd lib && make install) || usage "$0" "make install in lib failed"
44
45 # Remove stuff that's not needed by tex2lyx.
46
47 cd $PWD
48 RESOURCES="$INSTALLDIR"/`ls $INSTALLDIR | sed '/bin/d;/man/d'`
49 echo $RESOURCES
50 test -d "$RESOURCES" || \
51     usage "$0" "Unable to ascertain installed resources dir $RESOURCES"
52 BINDIR="$INSTALLDIR"/bin
53
54 rm -f  "$RESOURCES"/charset.alias
55 rm -rf "$RESOURCES"/locale
56 rm -f  "$BINDIR"/noweb2lyx
57 # Gets tex2lyx and tex2lyx.exe
58 strip "$BINDIR"/tex2lyx*
59
60 (
61   cd "$RESOURCES"/lyx
62   rm -f configure encodings external_templates languages lyxrc.example symbols
63 # 02/11/05, J>P. Chrétien, <chretien@cert.fr> 
64 # removed the scripts dir from the list as tex2lyx needs layout2layout
65 #  rm -rf bind clipart doc examples help images kbd scripts templates tex ui xfonts
66   rm -rf bind clipart doc examples help images kbd templates tex ui xfonts
67 )
68
69
70 # build the bundle
71 case $KERNEL in
72     win32)
73         which zip || {
74             PATH="/c/Program Files/ZIP":$PATH
75             export PATH
76         }
77
78         which zip || {
79             echo "zip is not in your PATH. Please add it here." >&2
80             exit 1
81         }
82
83         ARCHIVE="$ARCHIVEBASE".zip
84         rm -f "$ARCHIVE"
85         zip "$ARCHIVEBASE" `find "$INSTALLDIR" -name '*'`
86         ;;
87     *)
88         # Not all tars understand "cvzf", so do this in two steps.
89         ARCHIVE="$ARCHIVEBASE".tar
90         rm -f "$ARCHIVE"
91         tar cvf "$ARCHIVE" "$INSTALLDIR"
92         rm -f "$ARCHIVE".gz
93         gzip -9 "$ARCHIVE"
94         ARCHIVE="$ARCHIVE".gz
95         ;;
96 esac
97
98 echo "$PWD/$ARCHIVE available"
99 rm -rf "$INSTALLDIR"