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