]> git.lyx.org Git - lyx.git/blob - development/Win32/packaging/package_lyxwin.sh
Check if we are on column 0 for special case
[lyx.git] / development / Win32 / packaging / package_lyxwin.sh
1 #! /bin/sh
2
3 # This script aims to do averything necessary to automate the packaging
4 # of LyX/Win ready for an Windows Installer to be built.
5
6 # It copies these files into the appropriate places in the LyX tree.
7 #   qt-mt3.dll
8 #   libiconv-2.dll
9 #   mingw10.dll
10 #   clean_dvi.py
11 #   dv2dt.exe
12 #   dt2dv.exe
13
14 # It strips the executables.
15
16 # It adds formats and converters to the Resources/lyx/configure script to
17 # ensure that the generated .dvi file is usable.
18
19 # It removes all stuff generated by running configure:
20 #   doc/LaTeXConfig.lyx
21 #   lyxrc.defaults
22 #   packages.lst
23 #   textclass.lst
24
25 # The installee should regenerate them by running configure on his machine.
26
27 QT_DLL="$HOME/qt3/bin/qt-mt3.dll"
28 LIBICONV_DLL="/j/MinGW/bin/libiconv-2.dll"
29 MINGW_DLL="/j/MinGW/bin/mingwm10.dll"
30 CLEAN_DVI_PY="clean_dvi.py"
31 DTL_DIR=dtl
32 DT2DV="$DTL_DIR/dt2dv.exe"
33 DV2DT="$DTL_DIR/dv2dt.exe"
34
35 LYX_INSTALL_DIR="../../../build/installprefix"
36
37 # Change this to 'mv -f' when you are confident that
38 # the various sed scripts are working correctly.
39 MV='mv -f'
40
41 windows_packaging()
42 {
43     # Install the necessary .dlls and clean_dvi stuff.
44     for file in "${QT_DLL}" "${LIBICONV_DLL}" "${MINGW_DLL}" "${DT2DV}" "${DV2DT}"
45     do
46       cp "${file}" "$LYX_INSTALL_DIR"/bin/. || {
47           echo "Failed to copy ${file} to the LyX package" >&2
48           exit 1
49       }
50     done
51
52     cp "${CLEAN_DVI_PY}" "$LYX_INSTALL_DIR"/Resources/lyx/scripts/. || {
53         echo "Failed to copy ${CLEAN_DVI_PY} to the LyX package" >&2
54         exit 1
55     }
56
57     # Strip the executables
58     (
59         cd "${LYX_INSTALL_DIR}/bin"
60         for file in *.exe
61         do
62           strip $file
63         done
64     )
65
66     # Modify the configure script,
67     # * add a dvi2 format
68     # * change the latex->dvi converter to latex->dvi2
69     # * add a dvi2->dvi converter
70     # * fix the generated chkconfig.sed so that it works with versions of
71     #   sed that get confused by sed scripts with DOS line endings.
72     TMP=tmp.$$
73     CONFIGURE="${LYX_INSTALL_DIR}"/Resources/lyx/configure
74     # Do this to make it easy to compare the before and after files.
75     dos2unix "${CONFIGURE}"
76     sed '
77 # (Note that this sed script contains TAB characters.)
78 # Append the dvi2 format after the dvi format.
79 /^ *\\\\Format[  ]\{1,\}dvi[     ]\{1,\}/a\
80 \\\\Format dvi2   dvi   DraftDVI        ""
81
82 # Change the latex->dvi converter to latex->dvi2
83 # and append the dvi2->dvi converter
84 /^ *\\\\converter[       ]\{1,\}latex[   ]\{1,\}dvi[     ]\{1,\}/{
85 s/dvi/dvi2/
86 a\
87 \\\\converter dvi2 dvi "python \\\$\\\$s/scripts/clean_dvi.py \\\$\\\$i \\\$\\\$o" ""
88 }
89 ' "${CONFIGURE}" > "${TMP}"
90     cmp -s "${CONFIGURE}" "${TMP}" || {
91         diff -u "${CONFIGURE}" "${TMP}"
92         ${MV} "${TMP}" "${CONFIGURE}"
93     }
94     rm -f "${TMP}"
95
96     # Strip the executables
97     (
98         cd "${LYX_INSTALL_DIR}/Resources/lyx"
99         for file in doc/LaTeXConfig.lyx lyxrc.defaults packages.lst textclass.lst
100         do
101           rm -f $file
102         done
103     )
104 }
105
106
107 windows_packaging || exit 1
108
109 # The end