Merge pull request #1 from kiwix/cross_compilation_windows

Cross compilation windows
This commit is contained in:
Matthieu Gautier 2017-01-30 18:20:08 +01:00 committed by GitHub
commit c9626b8bd4
6 changed files with 373 additions and 28 deletions

View File

@ -1,6 +1,6 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import os, sys import os, sys, stat
import argparse import argparse
import urllib.request import urllib.request
import tarfile import tarfile
@ -8,8 +8,10 @@ import subprocess
import hashlib import hashlib
import shutil import shutil
import tempfile import tempfile
import configparser
from collections import defaultdict, namedtuple from collections import defaultdict, namedtuple
pj = os.path.join pj = os.path.join
REMOTE_PREFIX = 'http://download.kiwix.org/dev/' REMOTE_PREFIX = 'http://download.kiwix.org/dev/'
@ -74,6 +76,7 @@ def command(name):
except: except:
print("ERROR") print("ERROR")
raise raise
wrapper._wrapped = function
return wrapper return wrapper
return decorator return decorator
@ -108,9 +111,20 @@ def extract_archive(archive_path, dest_dir, topdir=None, name=None):
class BuildEnv: class BuildEnv:
build_targets = ['native', 'win32']
_targets_env = {
'native' : {},
'win32' : {'wrapper': 'mingw32-env'}
}
def __init__(self, options): def __init__(self, options):
self.source_dir = pj(options.working_dir, "SOURCE") self.source_dir = pj(options.working_dir, "SOURCE")
self.build_dir = pj(options.working_dir, "BUILD") build_dir = "BUILD_{target}_{libmod}".format(
target=options.build_target,
libmod='static' if options.build_static else 'dyn'
)
self.build_dir = pj(options.working_dir, build_dir)
self.archive_dir = pj(options.working_dir, "ARCHIVE") self.archive_dir = pj(options.working_dir, "ARCHIVE")
self.log_dir = pj(options.working_dir, 'LOGS') self.log_dir = pj(options.working_dir, 'LOGS')
self.install_dir = pj(self.build_dir, "INSTALL") self.install_dir = pj(self.build_dir, "INSTALL")
@ -119,11 +133,68 @@ class BuildEnv:
os.makedirs(self.build_dir, exist_ok=True) os.makedirs(self.build_dir, exist_ok=True)
os.makedirs(self.log_dir, exist_ok=True) os.makedirs(self.log_dir, exist_ok=True)
os.makedirs(self.install_dir, exist_ok=True) os.makedirs(self.install_dir, exist_ok=True)
self.setup_build_target(options.build_target)
self.ninja_command = self._detect_ninja() self.ninja_command = self._detect_ninja()
self.meson_command = self._detect_meson() self.meson_command = self._detect_meson()
self.options = options self.options = options
self.libprefix = options.libprefix or self._detect_libdir() self.libprefix = options.libprefix or self._detect_libdir()
def setup_build_target(self, build_target):
self.build_target = build_target
self.target_env = self._targets_env[self.build_target]
getattr(self, 'setup_{}'.format(self.build_target))()
def setup_native(self):
self.wrapper = None
self.configure_option = ""
self.cmake_option = ""
self.meson_crossfile = None
def _get_rpm_mingw32(self, value):
command = "rpm --eval %{{mingw32_{}}}".format(value)
output = subprocess.check_output(command, shell=True)
return output[:-1].decode()
def _gen_meson_crossfile(self):
self.meson_crossfile = pj(self.build_dir, 'cross_file.txt')
config = configparser.ConfigParser()
config['binaries'] = {
'c' : repr(self._get_rpm_mingw32('cc')),
'cpp' : repr(self._get_rpm_mingw32('cxx')),
'ar' : repr(self._get_rpm_mingw32('ar')),
'strip' : repr(self._get_rpm_mingw32('strip')),
'pkgconfig' : repr(self._get_rpm_mingw32('pkg_config')),
'exe_wrapper' : repr('wine') # A command used to run generated executables.
}
config['properties'] = {
'c_link_args': ['-lwinmm', '-lws2_32', '-lshlwapi', '-lrpcrt4'],
'cpp_link_args': ['-lwinmm', '-lws2_32', '-lshlwapi', '-lrpcrt4']
}
config['host_machine'] = {
'system' : repr('windows'),
'cpu_family' : repr('x86'),
'cpu' : repr('i586'),
'endian' : repr('little')
}
with open(self.meson_crossfile, 'w') as configfile:
config.write(configfile)
def setup_win32(self):
command = "rpm --eval %{mingw32_env}"
self.wrapper = pj(self.build_dir, 'mingw32-wrapper.sh')
with open(self.wrapper, 'w') as output:
output.write("#!/usr/bin/sh\n\n")
output.flush()
output.write(self._get_rpm_mingw32('env'))
output.write('\n\nexec "$@"\n')
output.flush()
current_permissions = stat.S_IMODE(os.lstat(self.wrapper).st_mode)
os.chmod(self.wrapper, current_permissions | stat.S_IXUSR)
self.configure_option = "--host=i686-w64-mingw32"
self.cmake_option = "-DCMAKE_SYSTEM_NAME=Windows"
self._gen_meson_crossfile()
def __getattr__(self, name): def __getattr__(self, name):
return getattr(self.options, name) return getattr(self.options, name)
@ -168,8 +239,10 @@ class BuildEnv:
if retcode == 0: if retcode == 0:
return n return n
def run_command(self, command, cwd, context, env=None, input=None): def run_command(self, command, cwd, context, env=None, input=None, allow_wrapper=True):
os.makedirs(cwd, exist_ok=True) os.makedirs(cwd, exist_ok=True)
if allow_wrapper and self.wrapper:
command = "{} {}".format(self.wrapper, command)
if env is None: if env is None:
env = dict(os.environ) env = dict(os.environ)
log = None log = None
@ -261,7 +334,7 @@ class ReleaseDownloadMixin:
context.try_skip(self.extract_path) context.try_skip(self.extract_path)
for p in self.patches: for p in self.patches:
with open(pj(SCRIPT_DIR, 'patches', p), 'r') as patch_input: with open(pj(SCRIPT_DIR, 'patches', p), 'r') as patch_input:
self.buildEnv.run_command("patch -p1", self.extract_path, context, input=patch_input) self.buildEnv.run_command("patch -p1", self.extract_path, context, input=patch_input, allow_wrapper=False)
def prepare(self): def prepare(self):
self._download() self._download()
@ -312,7 +385,7 @@ class MakeMixin:
command = "{configure_script} {configure_option} --prefix {install_dir} --libdir {libdir}" command = "{configure_script} {configure_option} --prefix {install_dir} --libdir {libdir}"
command = command.format( command = command.format(
configure_script = pj(self.source_path, self.configure_script), configure_script = pj(self.source_path, self.configure_script),
configure_option = self.configure_option, configure_option = "{} {}".format(self.configure_option, self.buildEnv.configure_option),
install_dir = self.buildEnv.install_dir, install_dir = self.buildEnv.install_dir,
libdir = pj(self.buildEnv.install_dir, self.buildEnv.libprefix) libdir = pj(self.buildEnv.install_dir, self.buildEnv.libprefix)
) )
@ -356,9 +429,9 @@ class CMakeMixin(MakeMixin):
@command("configure") @command("configure")
def _configure(self, context): def _configure(self, context):
context.try_skip(self.build_path) context.try_skip(self.build_path)
command = "cmake {configure_option} -DCMAKE_INSTALL_PREFIX={install_dir} -DCMAKE_INSTALL_LIBDIR={libdir} {source_path}" command = "cmake {configure_option} -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DCMAKE_INSTALL_PREFIX={install_dir} -DCMAKE_INSTALL_LIBDIR={libdir} {source_path}"
command = command.format( command = command.format(
configure_option = self.configure_option, configure_option = "{} {}".format(self.buildEnv.cmake_option, self.configure_option),
install_dir = self.buildEnv.install_dir, install_dir = self.buildEnv.install_dir,
libdir = self.buildEnv.libprefix, libdir = self.buildEnv.libprefix,
source_path = self.source_path source_path = self.source_path
@ -399,25 +472,27 @@ class MesonMixin(MakeMixin):
else: else:
library_type = 'shared' library_type = 'shared'
configure_option = self.configure_option.format(buildEnv=self.buildEnv) configure_option = self.configure_option.format(buildEnv=self.buildEnv)
command = "{command} --default-library={library_type} {configure_option} . {build_path} --prefix={buildEnv.install_dir} --libdir={buildEnv.libprefix}".format( command = "{command} --default-library={library_type} {configure_option} . {build_path} --prefix={buildEnv.install_dir} --libdir={buildEnv.libprefix} {cross_option}".format(
command = self.buildEnv.meson_command, command = self.buildEnv.meson_command,
library_type=library_type, library_type=library_type,
configure_option=configure_option, configure_option=configure_option,
build_path = self.build_path, build_path = self.build_path,
buildEnv=self.buildEnv) buildEnv=self.buildEnv,
self.buildEnv.run_command(command, self.source_path, context, env=env) cross_option = "--cross-file {}".format(self.buildEnv.meson_crossfile) if self.buildEnv.meson_crossfile else ""
)
self.buildEnv.run_command(command, self.source_path, context, env=env, allow_wrapper=False)
@command("compile") @command("compile")
def _compile(self, context): def _compile(self, context):
env = self._gen_env() env = self._gen_env()
command = "{} -v".format(self.buildEnv.ninja_command) command = "{} -v".format(self.buildEnv.ninja_command)
self.buildEnv.run_command(command, self.build_path, context, env=env) self.buildEnv.run_command(command, self.build_path, context, env=env, allow_wrapper=False)
@command("install") @command("install")
def _install(self, context): def _install(self, context):
env = self._gen_env() env = self._gen_env()
command = "{} -v install".format(self.buildEnv.ninja_command) command = "{} -v install".format(self.buildEnv.ninja_command)
self.buildEnv.run_command(command, self.build_path, context) self.buildEnv.run_command(command, self.build_path, context, allow_wrapper=False)
def build(self): def build(self):
self._configure() self._configure()
@ -458,7 +533,8 @@ class Xapian(Dependency, ReleaseDownloadMixin, MakeMixin):
version = "1.4.0" version = "1.4.0"
archive = Remotefile('xapian-core-1.4.0.tar.xz', archive = Remotefile('xapian-core-1.4.0.tar.xz',
'10584f57112aa5e9c0e8a89e251aecbf7c582097638bfee79c1fe39a8b6a6477') '10584f57112aa5e9c0e8a89e251aecbf7c582097638bfee79c1fe39a8b6a6477')
configure_option = "--enable-shared --enable-static --disable-sse --disable-backend-inmemory" configure_option = ("--enable-shared --enable-static --disable-sse "
"--disable-backend-inmemory --disable-documentation")
patches = ["xapian_pkgconfig.patch"] patches = ["xapian_pkgconfig.patch"]
configure_env = {'_format_LDFLAGS' : "-L{buildEnv.install_dir}/{buildEnv.libprefix}", configure_env = {'_format_LDFLAGS' : "-L{buildEnv.install_dir}/{buildEnv.libprefix}",
'_format_CXXFLAGS' : "-I{buildEnv.install_dir}/include"} '_format_CXXFLAGS' : "-I{buildEnv.install_dir}/include"}
@ -470,7 +546,12 @@ class CTPP2(Dependency, ReleaseDownloadMixin, CMakeMixin):
archive = Remotefile('ctpp2-2.8.3.tar.gz', archive = Remotefile('ctpp2-2.8.3.tar.gz',
'a83ffd07817adb575295ef40fbf759892512e5a63059c520f9062d9ab8fb42fc') 'a83ffd07817adb575295ef40fbf759892512e5a63059c520f9062d9ab8fb42fc')
configure_option = "-DMD5_SUPPORT=OFF" configure_option = "-DMD5_SUPPORT=OFF"
patches = ["ctpp2_include.patch", "ctpp2_no_src_modification.patch", "ctpp2_fix-static-libname.patch"] patches = ["ctpp2_include.patch",
"ctpp2_no_src_modification.patch",
"ctpp2_fix-static-libname.patch",
"ctpp2_mingw32.patch",
"ctpp2_dll_export_VMExecutable.patch",
"ctpp2_win_install_lib_in_lib_dir.patch"]
class Pugixml(Dependency, ReleaseDownloadMixin, MesonMixin): class Pugixml(Dependency, ReleaseDownloadMixin, MesonMixin):
@ -483,10 +564,11 @@ class Pugixml(Dependency, ReleaseDownloadMixin, MesonMixin):
class MicroHttpd(Dependency, ReleaseDownloadMixin, MakeMixin): class MicroHttpd(Dependency, ReleaseDownloadMixin, MakeMixin):
name = "libmicrohttpd" name = "libmicrohttpd"
version = "0.9.19"
archive = Remotefile('libmicrohttpd-0.9.19.tar.gz',
'dc418c7a595196f09d2f573212a0d794404fa4ac5311fc9588c1e7ad7a90fae6')
configure_option = "--enable-shared --enable-static --disable-https --without-libgcrypt --without-libcurl" configure_option = "--enable-shared --enable-static --disable-https --without-libgcrypt --without-libcurl"
version = "0.9.46"
archive = Remotefile('libmicrohttpd-0.9.46.tar.gz',
'06dbd2654f390fa1e8196fe063fc1449a6c2ed65a38199a49bf29ad8a93b8979',
'http://ftp.gnu.org/gnu/libmicrohttpd/libmicrohttpd-0.9.46.tar.gz')
class Icu(Dependency, ReleaseDownloadMixin, MakeMixin): class Icu(Dependency, ReleaseDownloadMixin, MakeMixin):
@ -497,10 +579,31 @@ class Icu(Dependency, ReleaseDownloadMixin, MakeMixin):
) )
data = Remotefile('icudt56l.dat', data = Remotefile('icudt56l.dat',
'e23d85eee008f335fc49e8ef37b1bc2b222db105476111e3d16f0007d371cbca') 'e23d85eee008f335fc49e8ef37b1bc2b222db105476111e3d16f0007d371cbca')
configure_option = "Linux --disable-samples --disable-tests --disable-extras --enable-static --disable-dyload" patches = ["icu4c_fix_static_lib_name_mingw.patch"]
configure_script = "runConfigureICU"
subsource_dir = "source" subsource_dir = "source"
def __init__(self, buildEnv, cross_compile_process=False, cross_build=None):
Dependency.__init__(self, buildEnv)
self.cross_compile_process = cross_compile_process
self.cross_build = cross_build
@property
def build_path(self):
if self.cross_compile_process and not self.cross_build:
return pj(self.buildEnv.build_dir, self.source_dir+"_native")
return pj(self.buildEnv.build_dir, self.source_dir)
@property
def configure_option(self):
default_configure_option = "--disable-samples --disable-tests --disable-extras --disable-dyload"
if self.buildEnv.build_static:
default_configure_option += " --enable-static --disable-shared"
else:
default_configure_option += " --enable-shared --enable-shared"
if self.cross_build:
return default_configure_option + " --with-cross-build=" + self.cross_build.build_path
return default_configure_option
@command("download_data") @command("download_data")
def _download_data(self, context): def _download_data(self, context):
self.buildEnv.download(self.data) self.buildEnv.download(self.data)
@ -510,6 +613,12 @@ class Icu(Dependency, ReleaseDownloadMixin, MakeMixin):
context.try_skip(self.source_path) context.try_skip(self.source_path)
shutil.copyfile(pj(self.buildEnv.archive_dir, self.data.name), pj(self.source_path, 'data', 'in', self.data.name)) shutil.copyfile(pj(self.buildEnv.archive_dir, self.data.name), pj(self.source_path, 'data', 'in', self.data.name))
@command("install")
def _install(self, context):
if self.cross_compile_process and not self.cross_build:
raise SkipCommand()
return super()._install._wrapped(self, context)
def prepare(self): def prepare(self):
super().prepare() super().prepare()
self._download_data() self._download_data()
@ -542,6 +651,22 @@ class KiwixTools(Dependency, GitCloneMixin, MesonMixin):
class Builder: class Builder:
def __init__(self, buildEnv): def __init__(self, buildEnv):
self.buildEnv = buildEnv self.buildEnv = buildEnv
if buildEnv.build_target != 'native':
subBuildEnv = BuildEnv(buildEnv.options)
subBuildEnv.setup_build_target('native')
nativeICU = Icu(subBuildEnv, True)
self.dependencies = [
Xapian(buildEnv),
CTPP2(buildEnv),
Pugixml(buildEnv),
Zimlib(buildEnv),
MicroHttpd(buildEnv),
nativeICU,
Icu(buildEnv, True, nativeICU),
Kiwixlib(buildEnv),
KiwixTools(buildEnv)
]
else:
self.dependencies = [UUID(buildEnv), self.dependencies = [UUID(buildEnv),
Xapian(buildEnv), Xapian(buildEnv),
CTPP2(buildEnv), CTPP2(buildEnv),
@ -567,8 +692,8 @@ def parse_args():
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('working_dir', default=".", nargs='?') parser.add_argument('working_dir', default=".", nargs='?')
parser.add_argument('--libprefix', default=None) parser.add_argument('--libprefix', default=None)
parser.add_argument('--target_arch', default="x86_64") parser.add_argument('--build-static', action="store_true")
parser.add_argument('--build_static', action="store_true") parser.add_argument('--build-target', default="native", choices=BuildEnv.build_targets)
parser.add_argument('--verbose', '-v', action="store_true", parser.add_argument('--verbose', '-v', action="store_true",
help=("Print all logs on stdout instead of in specific" help=("Print all logs on stdout instead of in specific"
" log files per commands")) " log files per commands"))

View File

@ -0,0 +1,12 @@
diff -ur ctpp2-2.8.3/include/CTPP2VMExecutable.hpp ctpp2-2.8.3.patched/include/CTPP2VMExecutable.hpp
--- ctpp2-2.8.3/include/CTPP2VMExecutable.hpp 2012-08-02 09:22:44.000000000 +0200
+++ ctpp2-2.8.3.patched/include/CTPP2VMExecutable.hpp 2017-01-17 11:47:08.332691919 +0100
@@ -52,7 +52,7 @@
@struct VMExecutable CTPP2VMExecutable.hpp <CTPP2VMExecutable.hpp>
@brief CTPP Executable file
*/
-struct VMExecutable
+struct CTPP2DECL VMExecutable
{
/** CTPP magic number */
UCHAR_8 magic[4]; // 'CTPP' xor 0xFFFFFFFF

View File

@ -0,0 +1,85 @@
diff -ur ctpp2-2.8.3/include/CTPP2SourceLoader.hpp ctpp2-2.8.3.patched/include/CTPP2SourceLoader.hpp
--- ctpp2-2.8.3/include/CTPP2SourceLoader.hpp 2017-01-09 17:00:57.542353340 +0100
+++ ctpp2-2.8.3.patched/include/CTPP2SourceLoader.hpp 2017-01-09 16:54:04.467316656 +0100
@@ -33,7 +33,7 @@
#define _CTPP2_SOURCE_LOADER_HPP__ 1
#ifdef _WIN32
-#include <Windows.h>
+#include <windows.h>
#else
#include <unistd.h>
#endif
diff -ur ctpp2-2.8.3/src/CTPP2DTOA.cpp ctpp2-2.8.3.patched/src/CTPP2DTOA.cpp
--- ctpp2-2.8.3/src/CTPP2DTOA.cpp 2012-11-11 00:50:01.000000000 +0100
+++ ctpp2-2.8.3.patched/src/CTPP2DTOA.cpp 2017-01-09 16:53:13.184181977 +0100
@@ -158,8 +158,8 @@
#include <stdio.h>
#include <errno.h>
-#ifdef _MSC_VER
- #include <WinSock2.h>
+#if defined(_MSC_VER) || defined(__MINGW32__)
+ #include <winsock2.h>
#ifndef BIG_ENDIAN
#define BIG_ENDIAN BIGENDIAN
#endif
diff -ur ctpp2-2.8.3/src/CTPP2StringIconvOutputCollector.cpp ctpp2-2.8.3.patched/src/CTPP2StringIconvOutputCollector.cpp
--- ctpp2-2.8.3/src/CTPP2StringIconvOutputCollector.cpp 2012-08-02 09:22:44.000000000 +0200
+++ ctpp2-2.8.3.patched/src/CTPP2StringIconvOutputCollector.cpp 2017-01-09 16:56:11.162179732 +0100
@@ -85,7 +85,7 @@
size_t iDstLength = CTPP_ESCAPE_BUFFER_LEN;
char aDstData[CTPP_ESCAPE_BUFFER_LEN];
-#if defined(linux) || defined(__APPLE__)
+#if defined(linux) || defined(__APPLE__) || defined(__MINGW32__)
char * aSrcData = (char *)vData;
#else
const char * aSrcData = (const char *)vData;
diff -ur ctpp2-2.8.3/src/functions/FnHostname.cpp ctpp2-2.8.3.patched/src/functions/FnHostname.cpp
--- ctpp2-2.8.3/src/functions/FnHostname.cpp 2012-11-10 21:40:36.000000000 +0100
+++ ctpp2-2.8.3.patched/src/functions/FnHostname.cpp 2017-01-09 16:58:53.987435623 +0100
@@ -34,8 +34,8 @@
#include "CTPP2Logger.hpp"
#include "FnHostname.hpp"
-#ifdef _MSC_VER
-#include <Winsock2.h>
+#if defined(_MSC_VER) || defined(__MINGW32__)
+#include <winsock2.h>
#else
#include <unistd.h>
#endif
diff -ur ctpp2-2.8.3/src/functions/FnIconv.cpp ctpp2-2.8.3.patched/src/functions/FnIconv.cpp
--- ctpp2-2.8.3/src/functions/FnIconv.cpp 2012-08-02 09:22:44.000000000 +0200
+++ ctpp2-2.8.3.patched/src/functions/FnIconv.cpp 2017-01-09 16:58:28.948857601 +0100
@@ -173,7 +173,7 @@
size_t iDstLength = CTPP_ESCAPE_BUFFER_LEN;
char aDstData[CTPP_ESCAPE_BUFFER_LEN];
-#if defined(linux) || defined(__APPLE__)
+#if defined(linux) || defined(__APPLE__) || defined(__MINGW32__)
char * aSrcData = (char *)sWhat.data();
#else
const char * aSrcData = (const char *)sWhat.data();
diff -ur ctpp2-2.8.3/src/functions/FnRandom.cpp ctpp2-2.8.3.patched/src/functions/FnRandom.cpp
--- ctpp2-2.8.3/src/functions/FnRandom.cpp 2012-11-10 21:36:30.000000000 +0100
+++ ctpp2-2.8.3.patched/src/functions/FnRandom.cpp 2017-01-09 16:59:59.879325141 +0100
@@ -37,7 +37,7 @@
#include <stdlib.h>
#include <time.h>
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__MINGW32__)
#define random() rand()
#define INT_64(x) (INT_64)(x)
#define srandomdev() srand( (unsigned)time(NULL) );
@@ -51,7 +51,7 @@
//
FnRandom::FnRandom()
{
-#if defined(__FreeBSD__) || defined(_MSC_VER)
+#if defined(__FreeBSD__) || defined(_MSC_VER) || defined(__MINGW32__)
srandomdev();
#else
srandom(time(NULL));

View File

@ -0,0 +1,12 @@
diff -ur ctpp2-2.8.3/CMakeLists.txt ctpp2-2.8.3.patched/CMakeLists.txt
--- ctpp2-2.8.3/CMakeLists.txt 2017-01-17 10:09:06.259494234 +0100
+++ ctpp2-2.8.3.patched/CMakeLists.txt 2017-01-17 11:48:18.427522886 +0100
@@ -785,7 +785,7 @@
INSTALL(TARGETS ctpp2-static DESTINATION lib${LIB_SUFFIX})
- INSTALL(TARGETS ctpp2 DESTINATION .)
+ INSTALL(TARGETS ctpp2 DESTINATION lib${LIB_SUFFIX})
FILE(WRITE ctpp2-config.cmd ${CTPP_COMPILER_HELPER})

View File

@ -0,0 +1,28 @@
diff -ur icu4c-56_1/source/config/mh-mingw icu4c-56_1.patched/source/config/mh-mingw
--- icu4c-56_1/source/config/mh-mingw 2015-10-08 05:54:32.000000000 +0200
+++ icu4c-56_1.patched/source/config/mh-mingw 2017-01-17 15:21:45.344657127 +0100
@@ -65,6 +65,10 @@
SO_TARGET_VERSION_SUFFIX =
endif
+## Remove shared library 's'
+STATIC_PREFIX_WHEN_USED =
+STATIC_PREFIX =
+
# Static library prefix and file extension
LIBSICU = lib$(LIBPREFIX)$(STATIC_PREFIX)$(ICUPREFIX)
A = a
diff -ur icu4c-56_1/source/config/mh-mingw64 icu4c-56_1.patched/source/config/mh-mingw64
--- icu4c-56_1/source/config/mh-mingw64 2015-10-08 05:54:30.000000000 +0200
+++ icu4c-56_1.patched/source/config/mh-mingw64 2017-01-17 14:25:14.072632426 +0100
@@ -65,6 +65,10 @@
SO_TARGET_VERSION_SUFFIX =
endif
+## Remove shared library 's'
+STATIC_PREFIX_WHEN_USED =
+STATIC_PREFIX =
+
# Static library prefix and file extension
LIBSICU = lib$(LIBPREFIX)$(STATIC_PREFIX)$(ICUPREFIX)
A = a

View File

@ -1,10 +1,93 @@
diff -ru xapian-core-1.4.0/pkgconfig/xapian-core.pc.in xapian-core-1.4.0_patched/pkgconfig/xapian-core.pc.in diff -ur xapian-core-1.4.0/configure.ac xapian-core-1.4.0.patched/configure.ac
--- xapian-core-1.4.0/pkgconfig/xapian-core.pc.in 2016-06-25 17:36:49.000000000 +0200 --- xapian-core-1.4.0/configure.ac 2016-06-25 17:36:49.000000000 +0200
+++ xapian-core-1.4.0_patched/pkgconfig/xapian-core.pc.in 2016-12-19 20:45:25.716329832 +0100 +++ xapian-core-1.4.0.patched/configure.ac 2017-01-17 14:33:42.268536542 +0100
@@ -11,4 +11,5 @@ @@ -393,6 +393,7 @@
esac
dnl We use timer_create() if available to implement a search time limit.
+use_rt_lib=0
SAVE_LIBS=$LIBS
AC_SEARCH_LIBS([timer_create], [rt],
[
@@ -403,12 +404,14 @@
#endif]])],
[AC_MSG_RESULT([yes])
XAPIAN_LIBS="$LIBS $XAPIAN_LIBS"
- AC_DEFINE([HAVE_TIMER_CREATE], [1], [Define to 1 if you have the 'timer_create' function.])]
+ AC_DEFINE([HAVE_TIMER_CREATE], [1], [Define to 1 if you have the 'timer_create' function.])
+ use_rt_lib=1]
,
[AC_MSG_RESULT([no])
])
])
LIBS=$SAVE_LIBS
+AM_CONDITIONAL([USE_RT_LIB], [test "$use_win32_uuid_api" = 1])
dnl Used by tests/soaktest/soaktest.cc
AC_CHECK_FUNCS([srandom random])
diff -ur xapian-core-1.4.0/configure xapian-core-1.4.0.patched/configure
--- xapian-core-1.4.0/configure 2016-06-25 17:39:25.000000000 +0200
+++ xapian-core-1.4.0.patched/configure 2017-01-17 15:43:07.929290801 +0100
@@ -671,6 +671,8 @@
DOCUMENTATION_RULES_FALSE
DOCUMENTATION_RULES_TRUE
PERL
+USE_RT_LIB_FALSE
+USE_RT_LIB_TRUE
ldflags
XAPIAN_LIBS
XAPIAN_LDFLAGS
@@ -18247,6 +18249,7 @@
;;
esac
+use_rt_lib=0
SAVE_LIBS=$LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing timer_create" >&5
$as_echo_n "checking for library containing timer_create... " >&6; }
@@ -18324,6 +18327,7 @@
$as_echo "#define HAVE_TIMER_CREATE 1" >>confdefs.h
+ use_rt_lib=1
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
@@ -18335,6 +18339,14 @@
fi
LIBS=$SAVE_LIBS
+ if test "$use_rt_lib" = 1; then
+ USE_RT_LIB_TRUE=
+ USE_RT_LIB_FALSE='#'
+else
+ USE_RT_LIB_TRUE='#'
+ USE_RT_LIB_FALSE=
+fi
+
for ac_func in srandom random
do :
@@ -20854,6 +20866,10 @@
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${USE_RT_LIB_TRUE}" && test -z "${USE_RT_LIB_FALSE}"; then
+ as_fn_error $? "conditional \"USE_RT_LIB\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${DOCUMENTATION_RULES_TRUE}" && test -z "${DOCUMENTATION_RULES_FALSE}"; then
as_fn_error $? "conditional \"DOCUMENTATION_RULES\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff -ur xapian-core-1.4.0/pkgconfig/xapian-core.pc.in xapian-core-1.4.0.patched/pkgconfig/xapian-core.pc.in
--- xapian-core-1.4.0/pkgconfig/xapian-core.pc.in 2017-01-17 15:22:40.184786108 +0100
+++ xapian-core-1.4.0.patched/pkgconfig/xapian-core.pc.in 2017-01-17 14:34:17.692972977 +0100
@@ -11,4 +11,6 @@
URL: https://xapian.org/ URL: https://xapian.org/
Version: @VERSION@ Version: @VERSION@
Cflags: -I${includedir} @abi_affecting_cxxflags@ Cflags: -I${includedir} @abi_affecting_cxxflags@
-Libs: @ldflags@ -L${libdir} -lxapian@LIBRARY_VERSION_SUFFIX@ -Libs: @ldflags@ -L${libdir} -lxapian@LIBRARY_VERSION_SUFFIX@
+Libs: @ldflags@ -L${libdir} -lxapian@LIBRARY_VERSION_SUFFIX@ -lrt +@USE_RT_LIB_TRUE@Libs: @ldflags@ -L${libdir} -lxapian@LIBRARY_VERSION_SUFFIX@ -lrt
+Requires: uuid +@USE_RT_LIB_FALSE@Libs: @ldflags@ -L${libdir} -lxapian@LIBRARY_VERSION_SUFFIX@
+@USE_WIN32_UUID_API_FALSE@Requires: uuid