3 # This script aims to do averything 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.
10 # This script is written as a bunch of subroutines. You'll probably
11 # only need to build a couple of the packages (dtl, aspell) once.
12 # Thereafter, the invocation of these subroutines can be commented out.
13 # (See the end of the script.)
16 # It uses the MinGW/MinSYS environment and compiler.
18 # It asks whether the Qt and LyX cvs trees are up to date.
19 # It asks whether the Qt library has been compiled.
20 # It checks that qt-mt3.dll, libiconv-2.dll,
21 # mingw10.dll and clean_dvi.py exist.
22 # It compiles the dv2dt and dt2dv utilites.
23 # It compiles and installs the Aspell library.
24 # It compiles and installs LyX.
25 # It copies the dv2dt and dt2dv utilites, the .dlls and
26 # clean_dvi.py to the lyx package.
27 # It modifies the Resources/lyx/configure script to
28 # ensure that the generated .dvi file is usable.
30 # Once all this is done, you're ready to "package" LyX.
31 # See the README for details.
33 # The script compiles the .dll version of the Qt libraries. Linking of lyx
34 # against this will, therefore, take "some time".
36 # It compiles the static version of the Aspell libraries because no
37 # .dll version exists.
41 # You may need to change these three variables.
43 ASPELL_DIR="${HOME}"/aspell-0.50.5
44 # A space-separated string of directories
45 # ASPELL_DICT_DIRS="${HOME}/aspell-en-0.50-2 ${HOME}/aspell-de-0.50-2 "
46 ASPELL_DICT_DIRS="${HOME}/aspell-en-0.50-2"
47 LYX_DIR="${HOME}"/lyx/13x
49 # Everything from here on down should be OK "as is".
50 PACKAGING_DIR="$LYX_DIR/development/Win32/packaging"
51 DTL_DIR="$PACKAGING_DIR/dtl"
52 CLEAN_DVI_DIR="$PACKAGING_DIR"
54 ASPELL_INSTALL_DIR="c:/Aspell"
55 LYX_ASPELL_DIR="/c/Aspell" # the Autotools don't like "C:/" syntax.
56 LYX_RELATIVE_BUILDDIR=build
57 LYX_INSTALL_DIR=installprefix
59 # These are all installed in the final LyX package
60 QT_DLL="${QT_DIR}/bin/qt-mt3.dll"
61 LIBICONV_DLL="/j/MinGW/bin/libiconv-2.dll"
62 MINGW_DLL="/j/MinGW/bin/mingwm10.dll"
64 DT2DV="$DTL_DIR/dt2dv.exe"
65 DV2DT="$DTL_DIR/dv2dt.exe"
66 CLEAN_DVI_PY="$CLEAN_DVI_DIR/clean_dvi.py"
68 # Change this to 'mv -f' when you are confident that
69 # the various sed scripts are working correctly.
74 for dir in "$QT_DIR" "$ASPELL_DIR" "$LYX_DIR" "$DTL_DIR"
77 echo "$dir does not exist" >&2
86 echo "Please ensure that the Qt and LyX cvs trees are up to date"
87 echo "and that the Qt library is compiled and ready to go."
88 echo "Press any key to continue"
95 # Check that the dlls and clean_dvi.py exist
96 for file in "${QT_DLL}" "${LIBICONV_DLL}" "${MINGW_DLL}" "${CLEAN_DVI_PY}"
98 test -r "${file}" || {
99 echo "$file does not exist" >&2
111 echo "Unable to cd $DTL_DIR" >&2
116 echo "Failed to make $DTL_DIR" >&2
121 for file in "${DT2DV}" "${DV2DT}"
124 echo "${file} does not exist or is not executable" >&2
135 cd "$ASPELL_DIR" || {
136 echo "Unable to cd $ASPELL_DIR" >&2
140 ./configure --enable-static --disable-shared --prefix="${ASPELL_INSTALL_DIR}" --sysconfdir="${ASPELL_INSTALL_DIR}" --enable-docdir="${ASPELL_INSTALL_DIR}/doc" --datadir="${ASPELL_INSTALL_DIR}/data" --enable-pkgdatadir="${ASPELL_INSTALL_DIR}/data" --enable-dict-dir="${ASPELL_INSTALL_DIR}/dict" --enable-win32-relocatable || {
141 echo "Failed to configure $ASPELL_DIR" >&2
145 # We have to clean up two of the generated Makefiles.
147 MAKEFILE=examples/Makefile
149 # Replace "CC = gcc" with "CC = g++"
150 s/^ *\(CC *= *\)gcc *$/\1g++/
151 # Remove trailing "/" from the -I directory.
152 s@^ *\(INCLUDES *= *-I\${top_srcdir}/interfaces/cc\)/ *$@\1@
153 ' "${MAKEFILE}" > "${TMP}"
154 cmp -s "${MAKEFILE}" "${TMP}" && {
155 echo "${MAKEFILE} is unchanged" 2>&1
157 diff -u "${MAKEFILE}" "${TMP}"
158 ${MV} "${TMP}" "${MAKEFILE}"
162 MAKEFILE=prog/Makefile
164 # Remove trailing "/" from the -I directories.
165 /^ *INCLUDES *= *-I\${top_srcdir}\/common/{
171 s@/ *\(\\ *\n\)@ \1@g
172 }' "${MAKEFILE}" > "${TMP}"
173 cmp -s "${MAKEFILE}" "${TMP}" && {
174 echo "${MAKEFILE} is unchanged" 2>&1
176 diff -u "${MAKEFILE}" "${TMP}"
177 ${MV} "${TMP}" "${MAKEFILE}"
182 echo "Failed to make $ASPELL_DIR" >&2
186 rm -fr "$ASPELL_INSTALL_DIR" || {
187 echo "Failed to remove $ASPELL_INSTALL_DIR prior to installing Aspell" >&2
192 echo "Failed to install $ASPELL_DIR" >&2
202 PATH="${LYX_ASPELL_DIR}:$PATH"
205 for dir in $ASPELL_DICT_DIRS
220 VERSION_C="src/version.C"
221 test -r "${VERSION_C}" || {
222 echo "Unable to find ${VERSION_C}"
225 test "${LYX_VERSION_STR}" == "" && return
227 sed '/char const \* lyx_version = /s/"[^"]*"/"'${LYX_VERSION_STR}'"/' \
228 ${VERSION_C} > tmp.$$
229 diff -u ${VERSION_C} tmp.$$
230 ${MV} tmp.$$ ${VERSION_C}
238 echo "Unable to cd ${LYX_DIR}" >&2
242 # Check the line endings of configure.ac
243 # The configure script will be unable to create config.h if it
244 # contains Win32-style line endings.
246 $//' ${LYX_DIR}/configure.ac > configure.ac.$$
247 cmp -s ${LYX_DIR}/configure.ac configure.ac.$$ && {
248 rm -f configure.ac.$$
250 mv -f configure.ac.$$ ${LYX_DIR}/configure.ac
251 echo 'configure.ac has Win32-style line endings. Corrected' >&2
255 echo "autogen.sh failed" >&2
259 BUILDDIR="${LYX_RELATIVE_BUILDDIR}"
260 test ! -d "${BUILDDIR}" && {
261 mkdir "${BUILDDIR}" || \
262 Error "Unable to create build dir, ${BUILDDIR}."
265 CONFIGURE="../configure --without-x --with-included-gettext --with-extra-prefix='${LYX_ASPELL_DIR}' --with-frontend=qt QTDIR='$QT_DIR'"
270 eval "${CONFIGURE}" || {
271 echo "Failed to configure LyX" >&2
275 # Modify the "lyx_version" string in build/src/version.C
280 echo "Failed to make $LYX_DIR" >&2
290 BUILDDIR="${LYX_RELATIVE_BUILDDIR}"
291 cd "${LYX_DIR}/${BUILDDIR}" || {
292 echo "Unable to cd ${LYX_DIR}/${BUILDDIR}" >&2
296 rm -fr "$LYX_INSTALL_DIR" || {
297 echo "Failed to remove $LYX_INSTALL_DIR prior to installing LyX" >&2
302 echo "Failed to install $LYX_DIR" >&2
309 test $# -ne 0 && LYX_VERSION_STR=$1
311 check_dirs_exist || exit 1
313 check_files_exist || exit 1
315 #build_aspell || exit 1
316 #build_aspell_dicts || exit 1
318 install_lyx || exit 1