3 # Configuration of the LyX sources suitable for compilation
4 # of a Windows build using the cygwin compiler.
7 # author Enrico Forestieri
15 echo "Usage: `basename $0` lyxdir [-d] [--qtdir=qt4dir] [--suffix[=versfx]]" >&2
16 echo "where lyxdir is the LyX source directory, -d specifies a debug build," >&2
17 echo "qt4dir is the directory where your Qt4 library is installed, and" >&2
18 echo "versfx is 'none', 'default' or the version suffix to use." >&2
24 QT4DIR=/usr/local/qt/4.7.4
26 ARGS=`getopt -o dq:s:: --long debug,qtdir:,suffix:: \
27 -n 'lyxconfig-cygwin' -- "$@"`
29 test $? != 0 && Error "Terminating..."
35 -d|--debug) BUILDTYPE=debug ; shift ;;
36 -q|--qtdir) QT4DIR=$2 ; shift 2 ;;
39 "") SUFFIX=default ; shift 2 ;;
40 *) SUFFIX=$2 ; shift 2 ;;
43 *) echo "Internal error!" ; exit 1 ;;
47 test $# -eq 1 || Error
50 test -d "${SRCDIR}" || Error "Directory '$SRCDIR' does not exist."
51 test -s "${SRCDIR}/configure" || \
52 Error "'${SRCDIR}/configure' does not exist."
54 test -d "$QT4DIR" || Error "The Qt4 directory '$QT4DIR' does not exist."
57 none) VERSION_SUFFIX='' ;;
58 default) VERSION_SUFFIX='--with-version-suffix' ;;
59 *) VERSION_SUFFIX='--with-version-suffix=${SUFFIX}' ;;
62 echo -n "Configuring ${SRCDIR} for building LyX"
63 test -n "$VERSION_SUFFIX" && echo " with $SUFFIX version suffix" || \
64 echo "with no version suffix"
67 FRONTEND_FLAGS="--with-qt4-dir='${QT4DIR}'"
68 BUILDDIR=${SRCDIR}/build-cygwin
70 test "${BUILDDIR}" != "${SRCDIR}" -a ! -d "${BUILDDIR}" && {
71 mkdir "${BUILDDIR}" || Error "Unable to create build dir, ${BUILDDIR}."
75 LDFLAGS="-shared-libgcc -Wl,-enable-stdcall-fixup -Wl,-enable-auto-import"
76 test "$BUILDTYPE" = "release" && {
78 LDFLAGS="$LDFLAGS -Wl,s"
79 ASSERTIONS="--disable-assertions"
80 WARNINGS="--disable-warnings"
83 ASSERTIONS="--enable-assertions"
84 WARNINGS="--enable-warnings"
87 CONFIGURE="../configure"
88 chmod u+x ${SRCDIR}/configure
89 sed -e 's/gl_have_weak=yes/gl_have_weak=no/' \
90 "${SRCDIR}/configure" > "${SRCDIR}/configure-cygwin"
91 touch -r "${SRCDIR}/configure" "${SRCDIR}/configure-cygwin"
92 mv -f "${SRCDIR}/configure-cygwin" "${SRCDIR}/configure"
94 # Set up configure itself
95 #========================
96 CONFIGURE="${CONFIGURE} ${ASSERTIONS} ${WARNINGS} \
97 --disable-shared --enable-static --disable-debug \
98 --disable-stdlib-debug --enable-optimization='${OPTFLAG}' \
99 --disable-pch --disable-concept-checks --without-x \
100 --with-included-gettext --with-aspell ${VERSION_SUFFIX} \
101 --with-frontend='${FRONTEND}' ${FRONTEND_FLAGS} \
102 --with-extra-lib=/usr/local/lib \
103 --prefix=/usr/local --mandir=/usr/local/man \
106 CPPFLAGS='${CPPFLAGS}' \
107 LDFLAGS='${LDFLAGS}'"
109 echo "Build directory is ${BUILDDIR}"
110 eval "echo \"${CONFIGURE}\""