commit
44cda40358
|
@ -68,6 +68,7 @@ env:
|
||||||
- PLATFORM="native_dyn"
|
- PLATFORM="native_dyn"
|
||||||
- PLATFORM="armhf_dyn"
|
- PLATFORM="armhf_dyn"
|
||||||
- PLATFORM="armhf_static"
|
- PLATFORM="armhf_static"
|
||||||
|
- PLATFORM="native_mixed"
|
||||||
addons:
|
addons:
|
||||||
ssh_known_hosts:
|
ssh_known_hosts:
|
||||||
- download.kiwix.org
|
- download.kiwix.org
|
||||||
|
|
|
@ -76,10 +76,7 @@ class Builder:
|
||||||
|
|
||||||
targetPlatform = PlatformInfo.get_platform(targetPlatformName)
|
targetPlatform = PlatformInfo.get_platform(targetPlatformName)
|
||||||
for dep in target.get_dependencies(targetPlatform, True):
|
for dep in target.get_dependencies(targetPlatform, True):
|
||||||
if isinstance(dep, tuple):
|
depPlatform, depName = targetPlatform.get_fully_qualified_dep(dep)
|
||||||
depPlatform, depName = dep
|
|
||||||
else:
|
|
||||||
depPlatform, depName = targetPlatformName, dep
|
|
||||||
if (depPlatform, depName) in targets:
|
if (depPlatform, depName) in targets:
|
||||||
yield from self.order_dependencies((depPlatform, depName), targets)
|
yield from self.order_dependencies((depPlatform, depName), targets)
|
||||||
yield ('source', targetName)
|
yield ('source', targetName)
|
||||||
|
|
|
@ -312,6 +312,7 @@ class MakeBuilder(Builder):
|
||||||
env = Defaultdict(str, os.environ)
|
env = Defaultdict(str, os.environ)
|
||||||
if self.buildEnv.platformInfo.static:
|
if self.buildEnv.platformInfo.static:
|
||||||
env['CFLAGS'] = env['CFLAGS'] + ' -fPIC'
|
env['CFLAGS'] = env['CFLAGS'] + ' -fPIC'
|
||||||
|
env['CXXFLAGS'] = env['CXXFLAGS'] + ' -fPIC'
|
||||||
if self.configure_env:
|
if self.configure_env:
|
||||||
for k in self.configure_env:
|
for k in self.configure_env:
|
||||||
if k.startswith('_format_'):
|
if k.startswith('_format_'):
|
||||||
|
@ -367,6 +368,7 @@ class CMakeBuilder(MakeBuilder):
|
||||||
env = Defaultdict(str, os.environ)
|
env = Defaultdict(str, os.environ)
|
||||||
if self.buildEnv.platformInfo.static:
|
if self.buildEnv.platformInfo.static:
|
||||||
env['CFLAGS'] = env['CFLAGS'] + ' -fPIC'
|
env['CFLAGS'] = env['CFLAGS'] + ' -fPIC'
|
||||||
|
env['CXXFLAGS'] = env['CXXFLAGS'] + ' -fPIC'
|
||||||
if self.configure_env:
|
if self.configure_env:
|
||||||
for k in self.configure_env:
|
for k in self.configure_env:
|
||||||
if k.startswith('_format_'):
|
if k.startswith('_format_'):
|
||||||
|
|
|
@ -2,6 +2,7 @@ from .base import (
|
||||||
Dependency,
|
Dependency,
|
||||||
GitClone,
|
GitClone,
|
||||||
MesonBuilder)
|
MesonBuilder)
|
||||||
|
from kiwixbuild._global import option
|
||||||
|
|
||||||
class Libzim(Dependency):
|
class Libzim(Dependency):
|
||||||
name = "libzim"
|
name = "libzim"
|
||||||
|
@ -21,4 +22,6 @@ class Libzim(Dependency):
|
||||||
return "-DUSE_BUFFER_HEADER=false"
|
return "-DUSE_BUFFER_HEADER=false"
|
||||||
if platformInfo.build == 'iOS':
|
if platformInfo.build == 'iOS':
|
||||||
return "-Db_bitcode=true"
|
return "-Db_bitcode=true"
|
||||||
|
if platformInfo.name == 'native_mixed' and option('target') == 'libzim':
|
||||||
|
return "-Dstatic-linkage=true"
|
||||||
return ""
|
return ""
|
||||||
|
|
|
@ -18,8 +18,8 @@ class Xapian(Dependency):
|
||||||
|
|
||||||
class Builder(MakeBuilder):
|
class Builder(MakeBuilder):
|
||||||
configure_option = "--disable-sse --disable-backend-chert --disable-backend-inmemory --disable-documentation"
|
configure_option = "--disable-sse --disable-backend-chert --disable-backend-inmemory --disable-documentation"
|
||||||
configure_env = {'_format_LDFLAGS': "-L{buildEnv.install_dir}/{buildEnv.libprefix}",
|
configure_env = {'_format_LDFLAGS': "{env.LDFLAGS} -L{buildEnv.install_dir}/{buildEnv.libprefix}",
|
||||||
'_format_CXXFLAGS': "-I{buildEnv.install_dir}/include"}
|
'_format_CXXFLAGS': "{env.CXXFLAGS} -I{buildEnv.install_dir}/include"}
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_dependencies(cls, platformInfo, allDeps):
|
def get_dependencies(cls, platformInfo, allDeps):
|
||||||
|
|
|
@ -30,7 +30,6 @@ PACKAGE_NAME_MAPPERS = {
|
||||||
},
|
},
|
||||||
'fedora_native_static': {
|
'fedora_native_static': {
|
||||||
'COMMON': _fedora_common + ['glibc-static', 'libstdc++-static'],
|
'COMMON': _fedora_common + ['glibc-static', 'libstdc++-static'],
|
||||||
'zlib': ['zlib-devel', 'zlib-static'],
|
|
||||||
'lzma': ['xz-devel', 'xz-static']
|
'lzma': ['xz-devel', 'xz-static']
|
||||||
# Either there is no packages, or no static or too old
|
# Either there is no packages, or no static or too old
|
||||||
},
|
},
|
||||||
|
@ -73,8 +72,6 @@ PACKAGE_NAME_MAPPERS = {
|
||||||
},
|
},
|
||||||
'debian_native_static': {
|
'debian_native_static': {
|
||||||
'COMMON': _debian_common + ['libbz2-dev', 'libmagic-dev'],
|
'COMMON': _debian_common + ['libbz2-dev', 'libmagic-dev'],
|
||||||
'zlib': ['zlib1g-dev'],
|
|
||||||
'uuid': ['uuid-dev'],
|
|
||||||
},
|
},
|
||||||
'debian_i586_dyn': {
|
'debian_i586_dyn': {
|
||||||
'COMMON': _debian_common + ['libc6-dev:i386', 'libstdc++-6-dev:i386', 'gcc-multilib', 'g++-multilib'],
|
'COMMON': _debian_common + ['libc6-dev:i386', 'libstdc++-6-dev:i386', 'gcc-multilib', 'g++-multilib'],
|
||||||
|
|
|
@ -65,6 +65,13 @@ class PlatformInfo(metaclass=_MetaPlatform):
|
||||||
depPlatform.add_targets(depName, targets)
|
depPlatform.add_targets(depName, targets)
|
||||||
return [(self.name, targetName)]
|
return [(self.name, targetName)]
|
||||||
|
|
||||||
|
def get_fully_qualified_dep(self, dep):
|
||||||
|
if isinstance(dep, tuple):
|
||||||
|
return dep
|
||||||
|
else:
|
||||||
|
return self.name, dep
|
||||||
|
|
||||||
|
|
||||||
def get_cross_config(self):
|
def get_cross_config(self):
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
from .base import PlatformInfo
|
from .base import PlatformInfo
|
||||||
|
|
||||||
|
from kiwixbuild.utils import pj
|
||||||
|
from kiwixbuild._global import option
|
||||||
|
|
||||||
|
|
||||||
class NativePlatformInfo(PlatformInfo):
|
class NativePlatformInfo(PlatformInfo):
|
||||||
build = 'native'
|
build = 'native'
|
||||||
|
@ -14,3 +17,33 @@ class NativeStatic(NativePlatformInfo):
|
||||||
name = 'native_static'
|
name = 'native_static'
|
||||||
static = True
|
static = True
|
||||||
compatible_hosts = ['fedora', 'debian']
|
compatible_hosts = ['fedora', 'debian']
|
||||||
|
|
||||||
|
class NativeMixed(NativePlatformInfo):
|
||||||
|
name = 'native_mixed'
|
||||||
|
static = False
|
||||||
|
compatible_hosts = ['fedora', 'debian']
|
||||||
|
|
||||||
|
def add_targets(self, targetName, targets):
|
||||||
|
print(targetName)
|
||||||
|
if option('target') == targetName:
|
||||||
|
return super().add_targets(targetName, targets)
|
||||||
|
else:
|
||||||
|
static_platform = self.get_platform('native_static', targets)
|
||||||
|
return static_platform.add_targets(targetName, targets)
|
||||||
|
|
||||||
|
def get_fully_qualified_dep(self, dep):
|
||||||
|
if isinstance(dep, tuple):
|
||||||
|
return dep
|
||||||
|
if option('target') == dep:
|
||||||
|
return 'native_mixed', dep
|
||||||
|
return 'native_static', dep
|
||||||
|
|
||||||
|
def set_env(self, env):
|
||||||
|
super().set_env(env)
|
||||||
|
static_platform = self.get_platform('native_static')
|
||||||
|
static_buildEnv = static_platform.buildEnv
|
||||||
|
static_install_dir = static_buildEnv.install_dir
|
||||||
|
env['CPPFLAGS'] = " ".join(['-I'+pj(static_install_dir, 'include'), env['CPPFLAGS']])
|
||||||
|
env['PATH'] = ':'.join([pj(static_install_dir, 'bin')] + [env['PATH']])
|
||||||
|
pkgconfig_path = pj(static_install_dir, static_buildEnv.libprefix, 'pkgconfig')
|
||||||
|
env['PKG_CONFIG_PATH'] = ':'.join([env['PKG_CONFIG_PATH'], pkgconfig_path])
|
||||||
|
|
|
@ -40,9 +40,10 @@ else:
|
||||||
|
|
||||||
# We have build everything. Now create archives for public deployement.
|
# We have build everything. Now create archives for public deployement.
|
||||||
BINARIES = {
|
BINARIES = {
|
||||||
'kiwix-tools': ('kiwix-manage', 'kiwix-read', 'kiwix-search', 'kiwix-serve'),
|
'kiwix-tools': ('bin', ('kiwix-manage', 'kiwix-read', 'kiwix-search', 'kiwix-serve')),
|
||||||
'zim-tools': ('zimbench', 'zimcheck', 'zimdump', 'zimsearch', 'zimdiff', 'zimpatch', 'zimsplit'),
|
'zim-tools': ('bin', ('zimbench', 'zimcheck', 'zimdump', 'zimsearch', 'zimdiff', 'zimpatch', 'zimsplit')),
|
||||||
'zimwriterfs': ('zimwriterfs',)
|
'zimwriterfs': ('bin', ('zimwriterfs',)),
|
||||||
|
'libzim': ('lib/x86_64-linux-gnu', ('libzim.so',))
|
||||||
}
|
}
|
||||||
|
|
||||||
_date = date.today().isoformat()
|
_date = date.today().isoformat()
|
||||||
|
@ -135,8 +136,8 @@ def create_desktop_image():
|
||||||
|
|
||||||
|
|
||||||
def make_archive(project, platform):
|
def make_archive(project, platform):
|
||||||
file_to_archives = BINARIES[project]
|
base_dir, file_to_archives = BINARIES[project]
|
||||||
base_bin_dir = BASE_DIR/'INSTALL'/'bin'
|
base_dir = BASE_DIR/'INSTALL'/base_dir
|
||||||
|
|
||||||
if make_release:
|
if make_release:
|
||||||
postfix = main_project_versions[project]
|
postfix = main_project_versions[project]
|
||||||
|
@ -167,11 +168,11 @@ def make_archive(project, platform):
|
||||||
if platform == "win-i686":
|
if platform == "win-i686":
|
||||||
file_to_archives = ['{}.exe'.format(f) for f in file_to_archives]
|
file_to_archives = ['{}.exe'.format(f) for f in file_to_archives]
|
||||||
open_archive = lambda a : zipfile.ZipFile(str(a), 'w', compression=zipfile.ZIP_DEFLATED)
|
open_archive = lambda a : zipfile.ZipFile(str(a), 'w', compression=zipfile.ZIP_DEFLATED)
|
||||||
archive_add = lambda a, f : a.write(str(base_bin_dir/f), arcname=str(f))
|
archive_add = lambda a, f : a.write(str(base_dir/f), arcname=str(f))
|
||||||
archive_ext = ".zip"
|
archive_ext = ".zip"
|
||||||
else:
|
else:
|
||||||
open_archive = lambda a : tarfile.open(str(a), 'w:gz')
|
open_archive = lambda a : tarfile.open(str(a), 'w:gz')
|
||||||
archive_add = lambda a, f : a.add(str(base_bin_dir/f), arcname="{}/{}".format(archive_name, str(f)))
|
archive_add = lambda a, f : a.add(str(base_dir/f), arcname="{}/{}".format(archive_name, str(f)))
|
||||||
archive_ext = ".tar.gz"
|
archive_ext = ".tar.gz"
|
||||||
|
|
||||||
|
|
||||||
|
@ -186,6 +187,8 @@ def make_deps_archive(target, full=False):
|
||||||
TRAVIS_OS_NAME, PLATFORM, target)
|
TRAVIS_OS_NAME, PLATFORM, target)
|
||||||
print_message("Create archive {}.", archive_name)
|
print_message("Create archive {}.", archive_name)
|
||||||
files_to_archive = [BASE_DIR/'INSTALL']
|
files_to_archive = [BASE_DIR/'INSTALL']
|
||||||
|
if PLATFORM == 'native_mixed':
|
||||||
|
files_to_archive += [HOME/'BUILD_native_static'/'INSTALL']
|
||||||
if PLATFORM.startswith('android'):
|
if PLATFORM.startswith('android'):
|
||||||
files_to_archive.append(HOME/'BUILD_neutral'/'INSTALL')
|
files_to_archive.append(HOME/'BUILD_neutral'/'INSTALL')
|
||||||
if PLATFORM == 'android':
|
if PLATFORM == 'android':
|
||||||
|
@ -297,6 +300,8 @@ if environ['TRAVIS_EVENT_TYPE'] != 'cron' and not make_release:
|
||||||
TARGETS = ('kiwix-lib', 'zim-tools', 'zimwriterfs')
|
TARGETS = ('kiwix-lib', 'zim-tools', 'zimwriterfs')
|
||||||
elif PLATFORM == 'native_dyn' and KIWIX_DESKTOP_ONLY:
|
elif PLATFORM == 'native_dyn' and KIWIX_DESKTOP_ONLY:
|
||||||
TARGETS = ('kiwix-desktop', )
|
TARGETS = ('kiwix-desktop', )
|
||||||
|
elif PLATFORM == 'native_mixed':
|
||||||
|
TARGETS = ('libzim', )
|
||||||
else:
|
else:
|
||||||
TARGETS = ('kiwix-tools', 'zim-tools', 'zimwriterfs')
|
TARGETS = ('kiwix-tools', 'zim-tools', 'zimwriterfs')
|
||||||
elif PLATFORM == 'flatpak':
|
elif PLATFORM == 'flatpak':
|
||||||
|
@ -327,6 +332,8 @@ elif PLATFORM.startswith('native_'):
|
||||||
else:
|
else:
|
||||||
if PLATFORM == 'native_dyn' and KIWIX_DESKTOP_ONLY:
|
if PLATFORM == 'native_dyn' and KIWIX_DESKTOP_ONLY:
|
||||||
TARGETS = ('kiwix-desktop', )
|
TARGETS = ('kiwix-desktop', )
|
||||||
|
elif PLATFORM == 'native_mixed':
|
||||||
|
TARGETS = ('libzim', )
|
||||||
else:
|
else:
|
||||||
TARGETS = ('libzim', 'zimwriterfs', 'zim-tools', 'kiwix-lib', 'kiwix-tools')
|
TARGETS = ('libzim', 'zimwriterfs', 'zim-tools', 'kiwix-lib', 'kiwix-tools')
|
||||||
elif PLATFORM == 'flatpak':
|
elif PLATFORM == 'flatpak':
|
||||||
|
@ -379,6 +386,8 @@ if make_release and PLATFORM == 'native_dyn':
|
||||||
in_file = BASE_DIR/full_target_name/'{}.tar.gz'.format(full_target_name)
|
in_file = BASE_DIR/full_target_name/'{}.tar.gz'.format(full_target_name)
|
||||||
if in_file.exists():
|
if in_file.exists():
|
||||||
shutil.copy(str(in_file), str(out_dir/target))
|
shutil.copy(str(in_file), str(out_dir/target))
|
||||||
|
elif PLATFORM == 'native_mixed':
|
||||||
|
make_archive('libzim', 'linux-x86_64')
|
||||||
elif PLATFORM == 'native_static':
|
elif PLATFORM == 'native_static':
|
||||||
for target in ('kiwix-tools', 'zim-tools', 'zimwriterfs'):
|
for target in ('kiwix-tools', 'zim-tools', 'zimwriterfs'):
|
||||||
make_archive(target, 'linux-x86_64')
|
make_archive(target, 'linux-x86_64')
|
||||||
|
|
Loading…
Reference in New Issue