2005-07-15 10:05:13 +00:00
|
|
|
#! /bin/sh
|
|
|
|
|
2006-03-02 19:15:43 +00:00
|
|
|
# This script aims to do everything necessary to automate the building
|
2005-07-15 10:05:13 +00:00
|
|
|
# of a LyX/Win package.
|
|
|
|
|
|
|
|
# Invocation:
|
|
|
|
# sh build_lyxwin.sh "1.3.6-pre23"
|
|
|
|
# The string will be shown in the "About LyX" dialog.
|
|
|
|
|
|
|
|
# Notes:
|
2006-03-02 19:15:43 +00:00
|
|
|
# It uses the MSYS environment and MinGW compiler.
|
2005-07-15 10:05:13 +00:00
|
|
|
|
|
|
|
# It asks whether the Qt and LyX cvs trees are up to date.
|
|
|
|
# It asks whether the Qt library has been compiled.
|
2006-03-02 19:15:43 +00:00
|
|
|
# It checks that qt-mt3.dll, mingw10.dll and clean_dvi.py exist.
|
2005-07-15 10:05:13 +00:00
|
|
|
# It compiles the dv2dt and dt2dv utilites.
|
|
|
|
# It compiles and installs LyX.
|
|
|
|
|
|
|
|
# Once all this is done, you're ready to "package" LyX.
|
|
|
|
# See the README for details.
|
|
|
|
|
2006-03-02 19:15:43 +00:00
|
|
|
# The script compiles the .dll version of the Qt libraries. Linking of LyX
|
2005-07-15 10:05:13 +00:00
|
|
|
# against this will, therefore, take "some time".
|
|
|
|
|
2005-07-17 21:31:02 +00:00
|
|
|
# You may need to change these four variables.
|
|
|
|
MINGW_DIR="/j/MinGW"
|
2006-03-02 19:15:43 +00:00
|
|
|
QT_DIR="${HOME}"/Qt/3x-msys
|
2005-07-15 10:05:13 +00:00
|
|
|
|
|
|
|
# Everything from here on down should be OK "as is".
|
2005-07-17 21:31:02 +00:00
|
|
|
LYX_DIR="../../.."
|
2005-07-15 10:05:13 +00:00
|
|
|
PACKAGING_DIR="$LYX_DIR/development/Win32/packaging"
|
|
|
|
DTL_DIR="$PACKAGING_DIR/dtl"
|
|
|
|
CLEAN_DVI_DIR="$PACKAGING_DIR"
|
|
|
|
|
|
|
|
ASPELL_INSTALL_DIR="c:/Aspell"
|
|
|
|
LYX_ASPELL_DIR="/c/Aspell" # the Autotools don't like "C:/" syntax.
|
|
|
|
LYX_RELATIVE_BUILDDIR=build
|
|
|
|
LYX_INSTALL_DIR=installprefix
|
|
|
|
|
|
|
|
# These are all installed in the final LyX package
|
|
|
|
QT_DLL="${QT_DIR}/bin/qt-mt3.dll"
|
2005-07-17 21:31:02 +00:00
|
|
|
MINGW_DLL="${MINGW_DIR}/bin/mingwm10.dll"
|
2005-07-15 10:05:13 +00:00
|
|
|
|
2005-07-17 21:31:02 +00:00
|
|
|
DT2DV="${DTL_DIR}/dt2dv.exe"
|
|
|
|
DV2DT="${DTL_DIR}/dv2dt.exe"
|
|
|
|
CLEAN_DVI_PY="${CLEAN_DVI_DIR}/clean_dvi.py"
|
2005-07-15 10:05:13 +00:00
|
|
|
|
|
|
|
# Change this to 'mv -f' when you are confident that
|
|
|
|
# the various sed scripts are working correctly.
|
|
|
|
MV='mv -f'
|
|
|
|
|
|
|
|
check_dirs_exist()
|
|
|
|
{
|
2006-03-02 19:15:43 +00:00
|
|
|
for dir in "$QT_DIR" "$LYX_DIR" "$DTL_DIR"
|
2005-07-15 10:05:13 +00:00
|
|
|
do
|
|
|
|
test -d "$dir" || {
|
|
|
|
echo "$dir does not exist" >&2
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
query_qt()
|
|
|
|
{
|
|
|
|
echo "Please ensure that the Qt and LyX cvs trees are up to date"
|
|
|
|
echo "and that the Qt library is compiled and ready to go."
|
|
|
|
echo "Press any key to continue"
|
|
|
|
read ans
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
check_files_exist()
|
|
|
|
{
|
|
|
|
# Check that the dlls and clean_dvi.py exist
|
2006-03-02 19:15:43 +00:00
|
|
|
for file in "${QT_DLL}" "${MINGW_DLL}" "${CLEAN_DVI_PY}"
|
2005-07-15 10:05:13 +00:00
|
|
|
do
|
|
|
|
test -r "${file}" || {
|
|
|
|
echo "$file does not exist" >&2
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
build_dtl()
|
|
|
|
{
|
|
|
|
# dt2dv and dv2dt
|
|
|
|
(
|
|
|
|
cd "$DTL_DIR" || {
|
|
|
|
echo "Unable to cd $DTL_DIR" >&2
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
make || {
|
|
|
|
echo "Failed to make $DTL_DIR" >&2
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
|
|
|
for file in "${DT2DV}" "${DV2DT}"
|
|
|
|
do
|
|
|
|
test -x "$file" || {
|
|
|
|
echo "${file} does not exist or is not executable" >&2
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
modify_version_C()
|
|
|
|
{
|
|
|
|
VERSION_C="src/version.C"
|
|
|
|
test -r "${VERSION_C}" || {
|
|
|
|
echo "Unable to find ${VERSION_C}"
|
|
|
|
return
|
|
|
|
}
|
|
|
|
test "${LYX_VERSION_STR}" == "" && return
|
|
|
|
|
|
|
|
sed '/char const \* lyx_version = /s/"[^"]*"/"'${LYX_VERSION_STR}'"/' \
|
|
|
|
${VERSION_C} > tmp.$$
|
|
|
|
diff -u ${VERSION_C} tmp.$$
|
|
|
|
${MV} tmp.$$ ${VERSION_C}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-03-02 19:15:43 +00:00
|
|
|
run_automake()
|
2005-07-15 10:05:13 +00:00
|
|
|
{
|
|
|
|
(
|
|
|
|
cd "${LYX_DIR}" || {
|
|
|
|
echo "Unable to cd ${LYX_DIR}" >&2
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
# Check the line endings of configure.ac
|
|
|
|
# The configure script will be unable to create config.h if it
|
|
|
|
# contains Win32-style line endings.
|
2006-03-02 19:15:43 +00:00
|
|
|
sed 's/\r$//' configure.ac > configure.ac.$$
|
|
|
|
cmp -s configure.ac configure.ac.$$ && {
|
2005-07-15 10:05:13 +00:00
|
|
|
rm -f configure.ac.$$
|
|
|
|
} || {
|
2006-03-02 19:15:43 +00:00
|
|
|
mv -f configure.ac.$$ configure.ac
|
|
|
|
cat <<EOF >&2
|
|
|
|
configure.ac has Win32-style line endings. Corrected
|
|
|
|
Please use the Cygwin flavours of the autotools to
|
|
|
|
run autogen.sh
|
|
|
|
EOF
|
|
|
|
exit 1
|
2005-07-15 10:05:13 +00:00
|
|
|
}
|
|
|
|
|
2006-03-02 19:15:43 +00:00
|
|
|
# ./autogen.sh || {
|
|
|
|
# echo "autogen.sh failed" >&2
|
|
|
|
# exit 1
|
|
|
|
# }
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
build_lyx()
|
|
|
|
{
|
|
|
|
(
|
|
|
|
cd "${LYX_DIR}" || {
|
|
|
|
echo "Unable to cd ${LYX_DIR}" >&2
|
2005-07-15 10:05:13 +00:00
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
BUILDDIR="${LYX_RELATIVE_BUILDDIR}"
|
|
|
|
test ! -d "${BUILDDIR}" && {
|
|
|
|
mkdir "${BUILDDIR}" || \
|
|
|
|
Error "Unable to create build dir, ${BUILDDIR}."
|
|
|
|
}
|
|
|
|
|
2006-03-02 19:15:43 +00:00
|
|
|
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"
|
2005-07-15 10:05:13 +00:00
|
|
|
|
|
|
|
echo "${CONFIGURE}"
|
|
|
|
cd "${BUILDDIR}"
|
|
|
|
echo "${PWD}"
|
|
|
|
eval "${CONFIGURE}" || {
|
|
|
|
echo "Failed to configure LyX" >&2
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
# Modify the "lyx_version" string in build/src/version.C
|
|
|
|
modify_version_C
|
|
|
|
|
|
|
|
# Build LyX
|
|
|
|
make || {
|
|
|
|
echo "Failed to make $LYX_DIR" >&2
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
install_lyx()
|
|
|
|
{
|
|
|
|
(
|
|
|
|
BUILDDIR="${LYX_RELATIVE_BUILDDIR}"
|
|
|
|
cd "${LYX_DIR}/${BUILDDIR}" || {
|
|
|
|
echo "Unable to cd ${LYX_DIR}/${BUILDDIR}" >&2
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
rm -fr "$LYX_INSTALL_DIR" || {
|
|
|
|
echo "Failed to remove $LYX_INSTALL_DIR prior to installing LyX" >&2
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
make install || {
|
2005-07-17 21:31:02 +00:00
|
|
|
echo "Failed to install" >&2
|
2005-07-15 10:05:13 +00:00
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
LYX_VERSION_STR=""
|
|
|
|
test $# -ne 0 && LYX_VERSION_STR=$1
|
|
|
|
|
|
|
|
check_dirs_exist || exit 1
|
|
|
|
query_qt || exit 1
|
|
|
|
check_files_exist || exit 1
|
2005-07-17 21:31:02 +00:00
|
|
|
build_dtl || exit 1
|
2006-03-02 19:15:43 +00:00
|
|
|
run_automake || exit 1
|
2005-07-15 10:05:13 +00:00
|
|
|
build_lyx || exit 1
|
|
|
|
install_lyx || exit 1
|
|
|
|
# The end
|