3 # This script aims to do everything necessary to automate the building
4 # of a LyX/Win package.
7 # sh build_lyxwin.sh "1.3.6-pre23"
8 # The string will be shown in the "About LyX" dialog.
11 # It uses the MSYS environment and MinGW compiler.
13 # It asks whether the Qt and LyX cvs trees are up to date.
14 # It asks whether the Qt library has been compiled.
15 # It checks that qt-mt3.dll, mingw10.dll and clean_dvi.py exist.
16 # It compiles the dv2dt and dt2dv utilites.
17 # It compiles and installs LyX.
19 # Once all this is done, you're ready to "package" LyX.
20 # See the README for details.
22 # The script compiles the .dll version of the Qt libraries. Linking of LyX
23 # against this will, therefore, take "some time".
25 # You may need to change these four variables.
27 QT_DIR="${HOME}"/Qt/3x-msys
29 # Everything from here on down should be OK "as is".
31 PACKAGING_DIR="$LYX_DIR/development/Win32/packaging"
32 DTL_DIR="$PACKAGING_DIR/dtl"
33 CLEAN_DVI_DIR="$PACKAGING_DIR"
35 ASPELL_INSTALL_DIR="c:/Aspell"
36 LYX_ASPELL_DIR="/c/Aspell" # the Autotools don't like "C:/" syntax.
37 LYX_RELATIVE_BUILDDIR=build
38 LYX_INSTALL_DIR=installprefix
40 # These are all installed in the final LyX package
41 QT_DLL="${QT_DIR}/bin/qt-mt3.dll"
42 MINGW_DLL="${MINGW_DIR}/bin/mingwm10.dll"
44 DT2DV="${DTL_DIR}/dt2dv.exe"
45 DV2DT="${DTL_DIR}/dv2dt.exe"
46 CLEAN_DVI_PY="${CLEAN_DVI_DIR}/clean_dvi.py"
48 # Change this to 'mv -f' when you are confident that
49 # the various sed scripts are working correctly.
54 for dir in "$QT_DIR" "$LYX_DIR" "$DTL_DIR"
57 echo "$dir does not exist" >&2
66 echo "Please ensure that the Qt and LyX cvs trees are up to date"
67 echo "and that the Qt library is compiled and ready to go."
68 echo "Press any key to continue"
75 # Check that the dlls and clean_dvi.py exist
76 for file in "${QT_DLL}" "${MINGW_DLL}" "${CLEAN_DVI_PY}"
78 test -r "${file}" || {
79 echo "$file does not exist" >&2
91 echo "Unable to cd $DTL_DIR" >&2
96 echo "Failed to make $DTL_DIR" >&2
101 for file in "${DT2DV}" "${DV2DT}"
104 echo "${file} does not exist or is not executable" >&2
113 VERSION_C="src/version.C"
114 test -r "${VERSION_C}" || {
115 echo "Unable to find ${VERSION_C}"
118 test "${LYX_VERSION_STR}" == "" && return
120 sed '/char const \* lyx_version = /s/"[^"]*"/"'${LYX_VERSION_STR}'"/' \
121 ${VERSION_C} > tmp.$$
122 diff -u ${VERSION_C} tmp.$$
123 ${MV} tmp.$$ ${VERSION_C}
131 echo "Unable to cd ${LYX_DIR}" >&2
135 # Check the line endings of configure.ac
136 # The configure script will be unable to create config.h if it
137 # contains Win32-style line endings.
138 sed 's/\r$//' configure.ac > configure.ac.$$
139 cmp -s configure.ac configure.ac.$$ && {
140 rm -f configure.ac.$$
142 mv -f configure.ac.$$ configure.ac
144 configure.ac has Win32-style line endings. Corrected
145 Please use the Cygwin flavours of the autotools to
152 # echo "autogen.sh failed" >&2
163 echo "Unable to cd ${LYX_DIR}" >&2
167 BUILDDIR="${LYX_RELATIVE_BUILDDIR}"
168 test ! -d "${BUILDDIR}" && {
169 mkdir "${BUILDDIR}" || \
170 Error "Unable to create build dir, ${BUILDDIR}."
173 CONFIGURE="../configure --without-x --with-included-gettext --with-extra-prefix='${LYX_ASPELL_DIR}' --with-frontend=qt QTDIR='$QT_DIR' --disable-maintainer-mode --disable-debug --enable-optimization --disable-pch --disable-concept-checks --disable-stdlib-debug"
178 eval "${CONFIGURE}" || {
179 echo "Failed to configure LyX" >&2
183 # Modify the "lyx_version" string in build/src/version.C
188 echo "Failed to make $LYX_DIR" >&2
198 BUILDDIR="${LYX_RELATIVE_BUILDDIR}"
199 cd "${LYX_DIR}/${BUILDDIR}" || {
200 echo "Unable to cd ${LYX_DIR}/${BUILDDIR}" >&2
204 rm -fr "$LYX_INSTALL_DIR" || {
205 echo "Failed to remove $LYX_INSTALL_DIR prior to installing LyX" >&2
210 echo "Failed to install" >&2
217 test $# -ne 0 && LYX_VERSION_STR=$1
219 check_dirs_exist || exit 1
221 check_files_exist || exit 1
223 run_automake || exit 1
225 install_lyx || exit 1