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 and mingw10.dll 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"
34 ASPELL_INSTALL_DIR="c:/Aspell"
35 LYX_ASPELL_DIR="/c/Aspell" # the Autotools don't like "C:/" syntax.
36 LYX_RELATIVE_BUILDDIR=build
37 LYX_INSTALL_DIR=installprefix
39 # These are all installed in the final LyX package
40 QT_DLL="${QT_DIR}/bin/qt-mt3.dll"
41 MINGW_DLL="${MINGW_DIR}/bin/mingwm10.dll"
43 DT2DV="${DTL_DIR}/dt2dv.exe"
44 DV2DT="${DTL_DIR}/dv2dt.exe"
46 # Change this to 'mv -f' when you are confident that
47 # the various sed scripts are working correctly.
52 for dir in "$QT_DIR" "$LYX_DIR" "$DTL_DIR"
55 echo "$dir does not exist" >&2
64 echo "Please ensure that the Qt and LyX cvs trees are up to date"
65 echo "and that the Qt library is compiled and ready to go."
66 echo "Press any key to continue"
73 # Check that the dlls exist
74 for file in "${QT_DLL}" "${MINGW_DLL}"
76 test -r "${file}" || {
77 echo "$file does not exist" >&2
89 echo "Unable to cd $DTL_DIR" >&2
94 echo "Failed to make $DTL_DIR" >&2
99 for file in "${DT2DV}" "${DV2DT}"
102 echo "${file} does not exist or is not executable" >&2
111 VERSION_C="src/version.C"
112 test -r "${VERSION_C}" || {
113 echo "Unable to find ${VERSION_C}"
116 test "${LYX_VERSION_STR}" == "" && return
118 sed '/char const \* lyx_version = /s/"[^"]*"/"'${LYX_VERSION_STR}'"/' \
119 ${VERSION_C} > tmp.$$
120 diff -u ${VERSION_C} tmp.$$
121 ${MV} tmp.$$ ${VERSION_C}
129 echo "Unable to cd ${LYX_DIR}" >&2
133 # Check the line endings of configure.ac
134 # The configure script will be unable to create config.h if it
135 # contains Win32-style line endings.
136 sed 's/\r$//' configure.ac > configure.ac.$$
137 cmp -s configure.ac configure.ac.$$ && {
138 rm -f configure.ac.$$
140 mv -f configure.ac.$$ configure.ac
142 configure.ac has Win32-style line endings. Corrected
143 Please use the Cygwin flavours of the autotools to
150 # echo "autogen.sh failed" >&2
161 echo "Unable to cd ${LYX_DIR}" >&2
165 BUILDDIR="${LYX_RELATIVE_BUILDDIR}"
166 test ! -d "${BUILDDIR}" && {
167 mkdir "${BUILDDIR}" || \
168 Error "Unable to create build dir, ${BUILDDIR}."
171 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"
176 eval "${CONFIGURE}" || {
177 echo "Failed to configure LyX" >&2
181 # Modify the "lyx_version" string in build/src/version.C
186 echo "Failed to make $LYX_DIR" >&2
196 BUILDDIR="${LYX_RELATIVE_BUILDDIR}"
197 cd "${LYX_DIR}/${BUILDDIR}" || {
198 echo "Unable to cd ${LYX_DIR}/${BUILDDIR}" >&2
202 rm -fr "$LYX_INSTALL_DIR" || {
203 echo "Failed to remove $LYX_INSTALL_DIR prior to installing LyX" >&2
208 echo "Failed to install" >&2
215 test $# -ne 0 && LYX_VERSION_STR=$1
217 check_dirs_exist || exit 1
219 check_files_exist || exit 1
221 run_automake || exit 1
223 install_lyx || exit 1