- Fix build failure on braches with Clang older than 3.4.

- Fix build failure on head due to libiconv link error.
- Remove redundant patches.
- Add cflags and cflags_cc flags to build_mozc.py.
This commit is contained in:
Hiroki Sato 2014-10-06 20:16:21 +00:00
parent 53dabf7d5a
commit f3e79f20fc
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=370219
4 changed files with 103 additions and 23 deletions

View file

@ -3,7 +3,7 @@
PORTNAME= mozc
PORTVERSION= 1.15.1868.102
PORTREVISION= 1
PORTREVISION= 2
CATEGORIES= japanese
MASTER_SITES= LOCAL/hrs
DISTFILES= ${DISTNAME}${EXTRACT_SUFX}
@ -22,7 +22,8 @@ LIB_DEPENDS= libprotobuf.so:${PORTSDIR}/devel/protobuf \
libzinnia.so:${PORTSDIR}/japanese/zinnia
RUN_DEPENDS= xdg-open:${PORTSDIR}/devel/xdg-utils
USES= compiler:c++0x pkgconfig iconv gmake tar:bzip2 python:build
USES= compiler:c++11-lang pkgconfig iconv:wchar_t gmake \
tar:bzip2 python:build
BUILD_MOZC_LIST?= mozc_server
@ -48,6 +49,21 @@ USE_GNOME= glib20 gtk20
USE_EMACS= yes
.endif
# Do not use Clang 3.3 or prior because of some C++11 library issues.
.if exists(/usr/bin/clang)
_CLANGVER!= /usr/bin/clang --version 2>&1 || true
.if !defined(_CLANGVER) || \
empty(_CLANGVER:M[0-9].[0-9]*:C/([0-9]).([0-9]).*/\1\2/g:M[0-9]*) || \
${_CLANGVER:M[0-9].[0-9]*:C/([0-9]).([0-9]).*/\1\2/g} < 34
USE_GCC= yes
_CCTYPE= gcc
.else
_CCTYPE= clang
.endif
.else
_CCTYPE= ${CHOSEN_COMPILER_TYPE}
.endif
.include <bsd.port.pre.mk>
.if ${OSVERSION} < 800107
@ -61,6 +77,8 @@ BROKEN= Does not compile: segfault
GYP_DEFINES= use_libprotobuf=1 \
channel_dev=0 \
enable_unittest=0 \
compiler_host="${_CCTYPE}" \
compiler_target="${_CCTYPE}" \
zinnia_model_file="${LOCALBASE}/share/tegaki/models/zinnia/handwriting-ja.model" \
ibus_mozc_icon_path="${LOCALBASE}/share/ibus-mozc/icons/product_icon.png" \
ibus_mozc_path="${PREFIX}/libexec/ibus-engine-mozc"
@ -106,6 +124,8 @@ post-configure: ${WRKSRC}/mozcmake
--server_dir="${PREFIX}/bin" \
--localbase="${LOCALBASE}" \
--ldflags="${LDFLAGS} -fstack-protector -L${LOCALBASE}/lib" \
--cflags="${CFLAGS:Q}" \
--cflags_cc="${CXXFLAGS:Q}" \
--include_dirs="${LOCALBASE}/include" \
${GYP_OPTIONS}
.endif

View file

@ -1,11 +0,0 @@
--- base/compiler_specific.h.orig 2013-07-17 11:38:04.000000000 +0900
+++ base/compiler_specific.h 2013-11-03 21:42:23.000000000 +0900
@@ -236,4 +236,8 @@
#endif // _MSC_VER or !_MSC_VER
// === End suppress warning C4355 macro definitions ===
+#ifndef static_assert
+#define static_assert(a,b)
+#endif
+
#endif // MOZC_BASE_COMPILER_SPECIFIC_H

View file

@ -1,16 +1,18 @@
--- build_mozc.py.orig 2014-08-31 03:36:22.000000000 +0900
+++ build_mozc.py 2014-08-31 06:04:34.000000000 +0900
@@ -351,6 +351,9 @@
+++ build_mozc.py 2014-09-17 04:37:10.000000000 +0900
@@ -351,6 +351,11 @@
parser.add_option('--version_file', dest='version_file',
help='use the specified version template file',
default='mozc_version_template.txt')
+ parser.add_option('--localbase', dest='localbase')
+ parser.add_option('--ldflags', dest='ldflags')
+ parser.add_option('--cflags', dest='cflags')
+ parser.add_option('--cflags_cc', dest='cflags_cc')
+ parser.add_option('--include_dirs', dest='include_dirs')
AddTargetPlatformOption(parser)
# Mac and Linux
@@ -538,7 +541,7 @@
@@ -538,7 +543,7 @@
parser = optparse.OptionParser(usage='Usage: %prog build [options]')
AddCommonOptions(parser)
if IsLinux():
@ -19,7 +21,7 @@
parser.add_option('--jobs', '-j', dest='jobs',
default=('%d' % default_build_concurrency),
metavar='N', help='run build jobs in parallel')
@@ -701,6 +704,13 @@
@@ -701,6 +706,17 @@
logging.info('Building GYP command line...')
gyp_options = ['--depth=.', '--include=%s/gyp/common.gypi' % SRC_DIR]
@ -28,6 +30,10 @@
+
+ ldflags = options.ldflags or ''
+ gyp_options.extend(['-D', 'ldflags=%s' % ldflags])
+ cflags = options.cflags or ''
+ gyp_options.extend(['-D', 'cflags=%s' % cflags])
+ cflags_cc = options.cflags_cc or ''
+ gyp_options.extend(['-D', 'cflags_cc=%s' % cflags_cc])
+ include_dirs = options.include_dirs or ''
+ gyp_options.extend(['-D', 'include_dirs=%s' % include_dirs])

View file

@ -1,6 +1,66 @@
--- gyp/common.gypi.orig 2014-08-31 03:36:19.000000000 +0900
+++ gyp/common.gypi 2014-08-31 03:46:27.000000000 +0900
@@ -759,6 +759,8 @@
+++ gyp/common.gypi 2014-09-17 04:33:49.000000000 +0900
@@ -171,9 +171,9 @@
['target_platform=="Linux"', {
# enable_gtk_renderer represents if mozc_renderer is supported on Linux
# or not.
- 'compiler_target': 'gcc',
+ 'compiler_target': '<(compiler_target)',
'compiler_target_version_int': 406, # GCC 4.6 or higher
- 'compiler_host': 'gcc',
+ 'compiler_host': '<(compiler_host)',
'compiler_host_version_int': 406, # GCC 4.6 or higher
'enable_gtk_renderer%': 1,
}, { # else
@@ -631,17 +631,20 @@
['compiler_target=="clang"', {
'cflags': [
'-Wtype-limits',
+ '<@(cflags)',
],
'cflags_cc': [
'-Wno-covered-switch-default',
'-Wno-unnamed-type-template-args',
'-Wno-c++11-narrowing',
- '-std=gnu++0x',
+ '-std=c++11',
+ '<@(cflags_cc)',
],
}],
- ['compiler_target=="clang" or compiler_target=="gcc"', {
+ ['compiler_host=="gcc"', {
'cflags_cc': [
- '-std=gnu++0x',
+ '-std=gnu++11',
+ '<@(cflags_cc)',
],
}],
],
@@ -651,17 +654,20 @@
['compiler_host=="clang"', {
'cflags': [
'-Wtype-limits',
+ '<@(cflags)',
],
'cflags_cc': [
'-Wno-covered-switch-default',
'-Wno-unnamed-type-template-args',
'-Wno-c++11-narrowing',
- '-std=gnu++0x',
+ '-std=c++11',
+ '<@(cflags_cc)',
],
}],
- ['compiler_host=="clang" or compiler_host=="gcc"', {
+ ['compiler_host=="gcc"', {
'cflags_cc': [
- '-std=gnu++0x',
+ '-std=gnu++11',
+ '<@(cflags_cc)',
],
}],
],
@@ -759,16 +765,27 @@
['OS=="linux"', {
'defines': [
'OS_LINUX',
@ -9,17 +69,22 @@
],
'cflags': [
'<@(warning_cflags)',
@@ -770,6 +772,13 @@
'-fPIC',
'-fno-exceptions',
+ '<@(cflags)',
],
'cflags_cc': [
# We use deprecated <hash_map> and <hash_set> instead of upcoming
# <unordered_map> and <unordered_set>.
'-Wno-deprecated',
],
+ '<@(cflags_cc)',
+ ],
+ 'include_dirs': [
+ '<@(include_dirs)'
+ ],
+ 'ldflags': [
+ '<@(ldflags)',
+ '-fstack-protector',
+ ],
],
'conditions': [
['target_platform!="NaCl"', {
'cflags': [