-
Notifications
You must be signed in to change notification settings - Fork 6
/
configure.ac
209 lines (185 loc) · 6.14 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
# vim:set et ts=4:
#
# ibus-gjs - GNOME-Shell GJS Plugin for IBus
#
# Copyright (c) 2011 Takao Fujiwara <[email protected]>
# Copyright (c) 2011 Red Hat, Inc.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place, Suite 330,
# Boston, MA 02111-1307 USA
AC_PREFEQ([2.62])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
# if not 1, append datestamp to the version number.
m4_define([ibus_released], [0])
m4_define([ibus_major_version], [3])
m4_define([ibus_minor_version], [4])
m4_define([ibus_micro_version], [1])
m4_define(ibus_maybe_datestamp,
m4_esyscmd([if test x]ibus_released[ != x1; then date +.%Y%m%d | tr -d '\n\r'; fi]))
m4_define([ibus_version],
ibus_major_version.ibus_minor_version.ibus_micro_version[]ibus_maybe_datestamp)
# This is the X.Y used in -libus-X.Y
m4_define([ibus_api_version], [1.0])
AC_INIT([ibus-gjs], [ibus_version],
[http://code.google.com/p/ibus/issues/entry],
[ibus-gjs])
# Init automake
AM_INIT_AUTOMAKE([1.10])
AM_MAINTAINER_MODE([enable])
AC_GNU_SOURCE
# Define sustituted variables:
IBUS_MAJOR_VERSION=ibus_major_version
IBUS_MINOR_VERSION=ibus_minor_version
IBUS_MICRO_VERSION=ibus_micro_version
IBUS_API_VERSION=ibus_api_version
AC_SUBST(IBUS_MAJOR_VERSION)
AC_SUBST(IBUS_MINOR_VERSION)
AC_SUBST(IBUS_MICRO_VERSION)
AC_SUBST(IBUS_API_VERSION)
# Check for programs
AC_PROG_INSTALL
# define PACKAGE_VERSION_* variables
AM_PROG_LIBTOOL
IT_PROG_INTLTOOL([0.35.0])
# dislpay Date
m4_define(ibus_datedisplay,
m4_esyscmd(date '+%a %b %d %Y' | tr -d '\n\r'))
DATE_DISPLAY="ibus_datedisplay"
AC_SUBST(DATE_DISPLAY)
# If only source code changed, lt_revision + 1
# If any interface added, lt_age + 1
# If any interfaces changed or removed, lt_current + 1, lt_revision = 0, lt_age = 0
m4_define([lt_current], [0])
m4_define([lt_revision], [0])
m4_define([lt_age], [0])
LT_VERSION_INFO="lt_current:lt_revision:lt_age"
AC_SUBST(LT_VERSION_INFO)
# check standalone
AC_MSG_CHECKING([whether you enable standalone])
AC_ARG_ENABLE(standalone,
AS_HELP_STRING([--enable-standalone=yes/no],
[Use this package with standalone default=yes]),
ENABLE_STANDALONE=yes,
ENABLE_STANDALONE=yes)
AC_SUBST(ENABLE_STANDALONE)
AC_MSG_RESULT($ENABLE_STANDALONE)
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
fi
# Check ibus
IBUS_PC_NAME=ibus-1.0
IBUS_XKB_PC_NAME=ibus-xkb
IBUS_MIN_VERSION=1.5.0
IBUS_XKB_MIN_VERSION=1.5.0
PKG_CHECK_MODULES(IBUS, [
$IBUS_PC_NAME >= $IBUS_MIN_VERSION
])
PKG_CHECK_MODULES(IBUS_XKB, [
$IBUS_XKB_PC_NAME >= $IBUS_XKB_MIN_VERSION
])
# Check GNOME-Shell VERSION
AC_ARG_WITH(gnome-shell-js-dir,
AS_HELP_STRING([--with-gnome-shell-js-dir[=$DIR]],
[Set js dir path (default: /usr/share/gnome-shell/js)]),
GNOME_SHELL_JS_DIR=$with_gnome_shell_js_dir,
GNOME_SHELL_JS_DIR="/usr/share/gnome-shell/js"
)
# versionCheck() in gnome-shell/js/ui/extensionSystem.js:
# @current must be in the format <major>.<minor>.<point>.<micro>
# <micro> is always ignored
# <point> is ignored if <minor> is even (so you can target the
# whole stable release)
# <minor> and <major> must match
# Each target version must be at least <major> and <minor>
SED=${SED:-'sed'}
ECHO=${ECHO:-'echo'}
GJS=${GJS:-'gjs'}
GET_JS_VERSION () {
VERSION_STRING=$1
CHECK_JS_VERSION_TEMPLATE="
try {
const Config = imports.misc.config;
let required = ${VERSION_STRING};
let requiredArray = required.split('.');
if (requiredArray[[1]] == undefined) {
print (required);
}
else if (requiredArray[[1]] % 2 == 0) {
print (requiredArray[[0]] + '.' + requiredArray[[1]]);
}
else if (requiredArray[[2]] == undefined || requiredArray[[3]] == undefined) {
print (required);
}
else {
let version = requiredArray[[0]];
version = version + '.' + requiredArray[[1]];
version = version + '.' + requiredArray[[2]];
print (version);
}
} catch (e) {
}
"
$GJS -I "$GNOME_SHELL_JS_DIR" -c "$CHECK_JS_VERSION_TEMPLATE"
}
# Check GNOME-Shell VERSION
AC_ARG_WITH(gnome-shell-version,
AS_HELP_STRING([--with-gnome-shell-version[=$DIR]],
[Set comma separated gnome-shell versions or auto (default: auto)]),
GNOME_SHELL_VERSION=$with_gnome_shell_version,
GNOME_SHELL_VERSION="auto"
)
if test x"$GNOME_SHELL_VERSION" = x'auto' ; then
GNOME_SHELL_VERSION=`GET_JS_VERSION 'Config.PACKAGE_VERSION'`
else
GNOME_SHELL_VERSION=`$ECHO "$GNOME_SHELL_VERSION" | $SED -e 's/,[ ]*/"&"/g'`
fi
AC_SUBST(GNOME_SHELL_VERSION)
# Check GJS VERSION
AC_ARG_WITH(gjs-version,
AS_HELP_STRING([--with-gjs-version[=$DIR]],
[Set comma separated gjs versions or auto (default: auto)]),
GJS_VERSION=$with_gjs_version,
GJS_VERSION="auto"
)
if test x"$GJS_VERSION" = x'auto' ; then
GJS_VERSION=`GET_JS_VERSION 'Config.GJS_VERSION'`
else
GJS_VERSION=`$ECHO "$GJS_VERSION" | $SED -e 's/,[ ]*/"&"/g'`
fi
AC_SUBST(GJS_VERSION)
# define GETTEXT_* variables
GETTEXT_PACKAGE=ibus-gjs
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package])
AM_GLIB_GNU_GETTEXT
# OUTPUT files
AC_CONFIG_FILES([ po/Makefile.in
Makefile
ibus-gjs.spec
js/Makefile
js/misc/config.js
extensions/Makefile
extensions/[email protected]/metadata.json
])
AC_OUTPUT
AC_MSG_RESULT([
Build options:
Version $VERSION
Install prefix $prefix
Enable standalone $ENABLE_STANDALONE
GNOME_SHELL_VERSION $GNOME_SHELL_VERSION
GJS_VERSION $GJS_VERSION
])