]> git.lyx.org Git - wiki-uploads.git/blob - Windows/Cygwin/Enrico/lyxconfig-cygwin
Import uploads from wiki
[wiki-uploads.git] / Windows / Cygwin / Enrico / lyxconfig-cygwin
1 #! /bin/sh
2
3 # Configuration of the LyX sources suitable for compilation
4 # of a Windows build using the cygwin compiler.
5
6 # author Angus Leeming
7 # author Enrico Forestieri
8
9 Error () {
10     test $# -gt 0 && {
11         echo $* >&2
12         echo >&2
13     }
14
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
19     exit 1
20 }
21
22 BUILDTYPE=release
23 SUFFIX=none
24 QT4DIR=/usr/local/qt/4.7.4
25
26 ARGS=`getopt -o dq:s:: --long debug,qtdir:,suffix:: \
27       -n 'lyxconfig-cygwin' -- "$@"`
28
29 test $? != 0 && Error "Terminating..."
30
31 eval set -- "$ARGS"
32
33 while true ; do
34     case "$1" in
35         -d|--debug) BUILDTYPE=debug ; shift ;;
36         -q|--qtdir) QT4DIR=$2 ; shift 2 ;;
37         -s|--suffix) 
38             case "$2" in
39                 "") SUFFIX=default ; shift 2 ;;
40                 *)  SUFFIX=$2 ; shift 2 ;;
41             esac ;;
42         --) shift ; break ;;
43         *) echo "Internal error!" ; exit 1 ;;
44     esac
45 done
46
47 test $# -eq 1 || Error
48
49 SRCDIR=$1
50 test -d "${SRCDIR}" || Error "Directory '$SRCDIR' does not exist."
51 test -s "${SRCDIR}/configure" || \
52     Error "'${SRCDIR}/configure' does not exist."
53
54 test -d "$QT4DIR" || Error "The Qt4 directory '$QT4DIR' does not exist."
55
56 case $SUFFIX in
57     none)    VERSION_SUFFIX='' ;;
58     default) VERSION_SUFFIX='--with-version-suffix' ;;
59     *)       VERSION_SUFFIX='--with-version-suffix=${SUFFIX}' ;;
60 esac
61
62 echo -n "Configuring ${SRCDIR} for building LyX"
63 test -n "$VERSION_SUFFIX" && echo " with $SUFFIX version suffix" || \
64     echo "with no version suffix"
65
66 FRONTEND="qt4"
67 FRONTEND_FLAGS="--with-qt4-dir='${QT4DIR}'"
68 BUILDDIR=${SRCDIR}/build-cygwin
69
70 test "${BUILDDIR}" != "${SRCDIR}" -a ! -d "${BUILDDIR}" && {
71     mkdir "${BUILDDIR}" || Error "Unable to create build dir, ${BUILDDIR}."
72 }
73
74 CPPFLAGS="-pipe"
75 LDFLAGS="-shared-libgcc -Wl,-enable-stdcall-fixup -Wl,-enable-auto-import"
76 test "$BUILDTYPE" = "release" && {
77     OPTFLAG=""
78     LDFLAGS="$LDFLAGS -Wl,s"
79     ASSERTIONS="--disable-assertions"
80     WARNINGS="--disable-warnings"
81 } || {
82     OPTFLAG="-g"
83     ASSERTIONS="--enable-assertions"
84     WARNINGS="--enable-warnings"
85 }
86
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"
93
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 \
104 CC='gcc-4' \
105 CXX='g++-4' \
106 CPPFLAGS='${CPPFLAGS}' \
107 LDFLAGS='${LDFLAGS}'"
108
109 echo "Build directory is ${BUILDDIR}"
110 eval "echo \"${CONFIGURE}\""
111 cd "${BUILDDIR}"
112 eval "${CONFIGURE}"
113
114 # The end