mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-13 16:18:42 +00:00
Tidy up ci scripts
Deprecated unused scripts and renamed Windows installer nsi file.
This commit is contained in:
@@ -1,5 +0,0 @@
|
||||
#!/bin/bash
|
||||
if [ "$BRANCH" = "master" ]
|
||||
then
|
||||
$TRAVIS_BUILD_DIR/$BRANCH/src/GoldenCheetah.app/Contents/MacOS/GoldenCheetah --version
|
||||
fi
|
||||
@@ -1,64 +0,0 @@
|
||||
require 'formula'
|
||||
|
||||
class Libkml < Formula
|
||||
homepage 'http://code.google.com/p/libkml/'
|
||||
|
||||
stable do
|
||||
url "https://libkml.googlecode.com/files/libkml-1.2.0.tar.gz"
|
||||
sha1 "3fa5acdc2b2185d7f0316d205002b7162f079894"
|
||||
|
||||
# Correct an issue where internal third-party libs (libminizip and liburiparser)
|
||||
# are installed as dylibs. liburiparser conflicts with uriparser formula.
|
||||
# libminizip conflicts with new formula, and some of its symbols have been
|
||||
# renamed with prefixes of "libkml_", i.e, can't be linked against for other builds
|
||||
# Fix just forces internal libs to be linked statically until the following
|
||||
# is addressed upstream: https://code.google.com/p/libkml/issues/detail?id=50
|
||||
patch do
|
||||
url "https://gist.githubusercontent.com/dakcarto/7419882/raw/10ae08af224b3fee0617fa6288d806d3ccf37c0f/libkml-1.2-static-deps"
|
||||
sha1 "eba47421e64e75bcf68026bbbe7c985b3bebcde5"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
head do
|
||||
url 'https://github.com/google/libkml.git',
|
||||
:revision => "9b50572641f671194e523ad21d0171ea6537426e"
|
||||
|
||||
depends_on "autoconf" => :build
|
||||
depends_on "automake" => :build
|
||||
depends_on "libtool" => :build
|
||||
end
|
||||
|
||||
# Fix compilation with clang and gcc 4.7+
|
||||
# https://code.google.com/p/libkml/issues/detail?id=179
|
||||
patch :DATA if build.stable?
|
||||
|
||||
def install
|
||||
if build.head?
|
||||
inreplace "third_party/Makefile.am" do |s|
|
||||
s.sub! /(lib_LTLIBRARIES =) libminizip.la liburiparser.la/, "\\1"
|
||||
s.sub! /(noinst_LTLIBRARIES = libgtest.la libgtest_main.la)/,
|
||||
"\\1 libminizip.la liburiparser.la"
|
||||
s.sub! /(libminizip_la_LDFLAGS =)/, "\\1 -static"
|
||||
s.sub! /(liburiparser_la_LDFLAGS =)/, "\\1 -static"
|
||||
end
|
||||
system "./autogen.sh"
|
||||
end
|
||||
|
||||
system "./configure", "--prefix=#{prefix}"
|
||||
system "make install"
|
||||
end
|
||||
end
|
||||
|
||||
__END__
|
||||
diff --git a/src/kml/base/file_posix.cc b/src/kml/base/file_posix.cc
|
||||
index 764ae55..8ee9892 100644
|
||||
--- a/src/kml/base/file_posix.cc
|
||||
+++ b/src/kml/base/file_posix.cc
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "kml/base/file.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
+#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
@@ -1,49 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
### This script should be run from GoldenCheetah root directory after build
|
||||
if [ ! -x src/GoldenCheetah ]
|
||||
then echo "Build GoldenCheetah and execute from distribution root"; exit 1
|
||||
fi
|
||||
|
||||
### Create AppDir and start populating
|
||||
mkdir -p appdir
|
||||
# Executable
|
||||
cp src/GoldenCheetah appdir
|
||||
# Desktop file
|
||||
cat >appdir/GoldenCheetah.desktop <<EOF
|
||||
[Desktop Entry]
|
||||
Version=1.0
|
||||
Type=Application
|
||||
Name=GoldenCheetah
|
||||
Comment=Cycling Power Analysis Software.
|
||||
Exec=GoldenCheetah
|
||||
Icon=gc
|
||||
Categories=Science;Sports;
|
||||
EOF
|
||||
# Icon
|
||||
cp ./src/Resources/images/gc.png appdir/
|
||||
|
||||
### Add OpenSSL libs
|
||||
mkdir appdir/lib
|
||||
cp /usr/lib/x86_64-linux-gnu/libssl.so appdir/lib
|
||||
cp /usr/lib/x86_64-linux-gnu/libcrypto.so appdir/lib
|
||||
|
||||
### Download current version of linuxdeployqt
|
||||
wget --no-verbose -c https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage
|
||||
chmod a+x linuxdeployqt-continuous-x86_64.AppImage
|
||||
|
||||
### Deploy to appdir and generate AppImage
|
||||
# -qmake=path-to-qmake-used-for-build option is necessary if the right qmakei
|
||||
# version is not first in PATH, check using qmake --version
|
||||
./linuxdeployqt-continuous-x86_64.AppImage appdir/GoldenCheetah -verbose=2 -bundle-non-qt-libs -exclude-libs=libqsqlmysql,libqsqlpsql,libnss3,libnssutil3,libxcb-dri3.so.0 -appimage
|
||||
|
||||
### Cleanup
|
||||
rm linuxdeployqt-continuous-x86_64.AppImage
|
||||
rm -rf appdir
|
||||
|
||||
### Minimum Test - Result is ./GoldenCheetah-x86_64.AppImage
|
||||
if [ ! -x ./GoldenCheetah-x86_64.AppImage ]
|
||||
then echo "AppImage not generated, check the errors"; exit 1
|
||||
fi
|
||||
./GoldenCheetah-x86_64.AppImage --version
|
||||
exit
|
||||
@@ -1,332 +0,0 @@
|
||||
"""
|
||||
finish the job started by macdeployqtfix
|
||||
"""
|
||||
from subprocess import Popen, PIPE
|
||||
from string import Template
|
||||
import os, sys
|
||||
import logging
|
||||
import argparse
|
||||
import re
|
||||
from collections import namedtuple
|
||||
|
||||
QTLIB_NAME_REGEX = r'^(?:@executable_path)?/.*/(Qt[a-zA-Z]*).framework/(?:Versions/\d/)?\1$'
|
||||
QTPLUGIN_NAME_REGEX = r'^(?:@executable_path)?/.*/[pP]lug[iI]ns/(.*)/(.*).dylib$'
|
||||
QTLIB_NORMALIZED = r'$prefix/Frameworks/$qtlib.framework/Versions/$qtversion/$qtlib'
|
||||
QTPLUGIN_NORMALIZED = r'$prefix/PlugIns/$plugintype/$pluginname.dylib'
|
||||
|
||||
|
||||
class GlobalConfig:
|
||||
|
||||
logger = None
|
||||
qtpath = None
|
||||
exepath = None
|
||||
|
||||
def run_and_get_output(popen_args):
|
||||
"""
|
||||
exec process and get all output
|
||||
"""
|
||||
process_output = namedtuple('ProcessOutput', ['stdout', 'stderr', 'retcode'])
|
||||
try:
|
||||
GlobalConfig.logger.debug('run_and_get_output({0})'.format(repr(popen_args)))
|
||||
|
||||
proc = Popen(popen_args, stdin=PIPE, stdout=PIPE, stderr=PIPE)
|
||||
stdout, stderr = proc.communicate(b'')
|
||||
proc_out = process_output(stdout, stderr, proc.returncode)
|
||||
|
||||
GlobalConfig.logger.debug('\tprocess_output: {0}'.format(proc_out))
|
||||
return proc_out
|
||||
except Exception as exc:
|
||||
GlobalConfig.logger.error('\texception: {0}'.format(exc))
|
||||
return process_output('', exc.message, -1)
|
||||
|
||||
def get_dependencies(filename):
|
||||
"""
|
||||
input: filename fullpath
|
||||
should call otool on mac and returns the list of dependencies,
|
||||
unsorted, unmodified, just the raw list
|
||||
so then we could eventually re-use in other more specialized functions
|
||||
"""
|
||||
GlobalConfig.logger.debug('get_dependencies({0})'.format(filename))
|
||||
popen_args = ['otool', '-L', filename]
|
||||
proc_out = run_and_get_output(popen_args)
|
||||
deps = []
|
||||
if proc_out.retcode == 0:
|
||||
# some string splitting
|
||||
deps = [s.strip().split(' ')[0] for s in proc_out.stdout.splitlines()[1:] if s]
|
||||
# prevent infinite recursion when a binary depends on itself (seen with QtWidgets)...
|
||||
deps = [s for s in deps if os.path.basename(filename) not in s]
|
||||
return deps
|
||||
|
||||
def is_qt_plugin(filename):
|
||||
"""
|
||||
check if a given file is a qt plugin
|
||||
accept absolute path as well as path containing @executable_path
|
||||
"""
|
||||
qtlib_name_rgx = re.compile(QTPLUGIN_NAME_REGEX)
|
||||
rgxret = qtlib_name_rgx.match(filename)
|
||||
if rgxret is not None:
|
||||
GlobalConfig.logger.debug('rgxret is not None for {0}: {1}'.format(filename, rgxret.groups()))
|
||||
return rgxret is not None
|
||||
|
||||
def is_qt_lib(filename):
|
||||
"""
|
||||
check if a given file is a qt library
|
||||
accept absolute path as well as path containing @executable_path
|
||||
"""
|
||||
qtlib_name_rgx = re.compile(QTLIB_NAME_REGEX)
|
||||
rgxret = qtlib_name_rgx.match(filename)
|
||||
return rgxret is not None
|
||||
|
||||
def normalize_qtplugin_name(filename):
|
||||
"""
|
||||
input: a path to a qt plugin, as returned by otool, that can have this form :
|
||||
- an absolute path /../plugins/PLUGINTYPE/PLUGINNAME.dylib
|
||||
- @executable_path/../plugins/PLUGINTYPE/PLUGINNAME.dylib
|
||||
output:
|
||||
a tuple (qtlib, abspath, rpath) where:
|
||||
- qtname is the name of the plugin (libqcocoa.dylib, etc.)
|
||||
- abspath is the absolute path of the qt lib inside the app bundle of exepath
|
||||
- relpath is the correct rpath to a qt lib inside the app bundle
|
||||
"""
|
||||
|
||||
GlobalConfig.logger.debug('normalize_plugin_name({0})'.format(filename))
|
||||
|
||||
qtplugin_name_rgx = re.compile(QTPLUGIN_NAME_REGEX)
|
||||
rgxret = qtplugin_name_rgx.match(filename)
|
||||
if not rgxret:
|
||||
msg = 'couldn\'t normalize a non-qt plugin filename: {0}'.format(filename)
|
||||
GlobalConfig.logger.critical(msg)
|
||||
raise Exception(msg)
|
||||
|
||||
# qtplugin normalization settings
|
||||
qtplugintype = rgxret.groups()[0]
|
||||
qtpluginname = rgxret.groups()[1]
|
||||
|
||||
templ = Template(QTPLUGIN_NORMALIZED)
|
||||
# from qtlib, forge 2 path :
|
||||
# - absolute path of qt lib in bundle,
|
||||
abspath = os.path.normpath(templ.safe_substitute(
|
||||
prefix=os.path.dirname(GlobalConfig.exepath) + '/..',
|
||||
plugintype=qtplugintype,
|
||||
pluginname=qtpluginname))
|
||||
# - and rpath containing @executable_path, relative to exepath
|
||||
rpath = templ.safe_substitute(
|
||||
prefix='@executable_path/..',
|
||||
plugintype=qtplugintype,
|
||||
pluginname=qtpluginname)
|
||||
|
||||
GlobalConfig.logger.debug('\treturns({0})'.format((qtpluginname, abspath, rpath)))
|
||||
return qtpluginname, abspath, rpath
|
||||
|
||||
def normalize_qtlib_name(filename):
|
||||
"""
|
||||
input: a path to a qt library, as returned by otool, that can have this form :
|
||||
- an absolute path /lib/xxx/yyy
|
||||
- @executable_path/../Frameworks/QtSerialPort.framework/Versions/5/QtSerialPort
|
||||
output:
|
||||
a tuple (qtlib, abspath, rpath) where:
|
||||
- qtlib is the name of the qtlib (QtCore, QtWidgets, etc.)
|
||||
- abspath is the absolute path of the qt lib inside the app bundle of exepath
|
||||
- relpath is the correct rpath to a qt lib inside the app bundle
|
||||
"""
|
||||
GlobalConfig.logger.debug('normalize_qtlib_name({0})'.format(filename))
|
||||
|
||||
qtlib_name_rgx = re.compile(QTLIB_NAME_REGEX)
|
||||
rgxret = qtlib_name_rgx.match(filename)
|
||||
if not rgxret:
|
||||
msg = 'couldn\'t normalize a non-qt lib filename: {0}'.format(filename)
|
||||
GlobalConfig.logger.critical(msg)
|
||||
raise Exception(msg)
|
||||
|
||||
# qtlib normalization settings
|
||||
qtlib = rgxret.groups()[0]
|
||||
qtversion = 5
|
||||
|
||||
templ = Template(QTLIB_NORMALIZED)
|
||||
# from qtlib, forge 2 path :
|
||||
# - absolute path of qt lib in bundle,
|
||||
abspath = os.path.normpath(templ.safe_substitute(
|
||||
prefix=os.path.dirname(GlobalConfig.exepath) + '/..',
|
||||
qtlib=qtlib,
|
||||
qtversion=qtversion))
|
||||
# - and rpath containing @executable_path, relative to exepath
|
||||
rpath = templ.safe_substitute(
|
||||
prefix='@executable_path/..',
|
||||
qtlib=qtlib,
|
||||
qtversion=qtversion)
|
||||
|
||||
GlobalConfig.logger.debug('\treturns({0})'.format((qtlib, abspath, rpath)))
|
||||
return qtlib, abspath, rpath
|
||||
|
||||
def fix_dependency(binary, dep):
|
||||
"""
|
||||
fix 'dep' dependency of 'binary'. 'dep' is a qt library
|
||||
"""
|
||||
if is_qt_lib(dep):
|
||||
qtname, dep_abspath, dep_rpath = normalize_qtlib_name(dep)
|
||||
elif is_qt_plugin(dep):
|
||||
qtname, dep_abspath, dep_rpath = normalize_qtplugin_name(dep)
|
||||
else:
|
||||
return True
|
||||
|
||||
dep_ok = True
|
||||
# check that rpath of 'dep' inside binary has been correctly set
|
||||
# (ie: relative to exepath using '@executable_path' syntax)
|
||||
if dep != dep_rpath:
|
||||
# dep rpath is not ok
|
||||
GlobalConfig.logger.info('changing rpath \'{0}\' in binary {1}'.format(dep, binary))
|
||||
|
||||
# call install_name_tool -change on binary
|
||||
popen_args = ['install_name_tool', '-change', dep, dep_rpath, binary]
|
||||
proc_out = run_and_get_output(popen_args)
|
||||
if proc_out.retcode != 0:
|
||||
GlobalConfig.logger.error(proc_out.stderr)
|
||||
dep_ok = False
|
||||
else:
|
||||
# call install_name_tool -id on binary
|
||||
popen_args = ['install_name_tool', '-id', dep_rpath, binary]
|
||||
proc_out = run_and_get_output(popen_args)
|
||||
if proc_out.retcode != 0:
|
||||
GlobalConfig.logger.error(proc_out.stderr)
|
||||
dep_ok = False
|
||||
|
||||
# now ensure that 'dep' exists at the specified path, relative to bundle
|
||||
if dep_ok and not os.path.exists(dep_abspath):
|
||||
|
||||
# ensure destination directory exists
|
||||
GlobalConfig.logger.info('ensuring directory \'{0}\' exists: {0}'.
|
||||
format(os.path.dirname(dep_abspath)))
|
||||
popen_args = ['mkdir', '-p', os.path.dirname(dep_abspath)]
|
||||
proc_out = run_and_get_output(popen_args)
|
||||
if proc_out.retcode != 0:
|
||||
GlobalConfig.logger.info(proc_out.stderr)
|
||||
dep_ok = False
|
||||
else:
|
||||
# copy missing dependency into bundle
|
||||
qtnamesrc = os.path.join(GlobalConfig.qtpath, 'lib', '{0}.framework'.
|
||||
format(qtname), qtname)
|
||||
GlobalConfig.logger.info('copying missing dependency in bundle: {0}'.
|
||||
format(qtname))
|
||||
popen_args = ['cp', qtnamesrc, dep_abspath]
|
||||
proc_out = run_and_get_output(popen_args)
|
||||
if proc_out.retcode != 0:
|
||||
GlobalConfig.logger.info(proc_out.stderr)
|
||||
dep_ok = False
|
||||
else:
|
||||
# ensure permissions are correct if we ever have to change its rpath
|
||||
GlobalConfig.logger.info('ensuring 755 perm to {0}'.format(dep_abspath))
|
||||
popen_args = ['chmod', '755', dep_abspath]
|
||||
proc_out = run_and_get_output(popen_args)
|
||||
if proc_out.retcode != 0:
|
||||
GlobalConfig.logger.info(proc_out.stderr)
|
||||
dep_ok = False
|
||||
else:
|
||||
GlobalConfig.logger.debug('{0} is at correct location in bundle'.format(qtname))
|
||||
|
||||
if dep_ok:
|
||||
return fix_binary(dep_abspath)
|
||||
return False
|
||||
|
||||
def fix_binary(binary):
|
||||
"""
|
||||
input:
|
||||
binary: relative or absolute path (no @executable_path syntax)
|
||||
process:
|
||||
- first fix the rpath for the qt libs on which 'binary' depend
|
||||
- copy into the bundle of exepath the eventual libraries that are missing
|
||||
- (create the soft links) needed ?
|
||||
- do the same for all qt dependencies of binary (recursive)
|
||||
"""
|
||||
GlobalConfig.logger.debug('fix_binary({0})'.format(binary))
|
||||
|
||||
# loop on 'binary' dependencies
|
||||
for dep in get_dependencies(binary):
|
||||
if not fix_dependency(binary, dep):
|
||||
GlobalConfig.logger.error('quitting early: couldn\'t fix dependency {0} of {1}'.format(dep, binary))
|
||||
return False
|
||||
return True
|
||||
|
||||
def fix_main_binaries():
|
||||
"""
|
||||
list the main binaries of the app bundle and fix them
|
||||
"""
|
||||
# deduce bundle path
|
||||
bundlepath = os.path.sep.join(GlobalConfig.exepath.split(os.path.sep)[0:-3])
|
||||
|
||||
# fix main binary
|
||||
GlobalConfig.logger.info('fixing executable \'{0}\''.format(GlobalConfig.exepath))
|
||||
if fix_binary(GlobalConfig.exepath):
|
||||
GlobalConfig.logger.info('fixing plugins')
|
||||
for root, dummy, files in os.walk(bundlepath):
|
||||
for name in [f for f in files if os.path.splitext(f)[1] == '.dylib']:
|
||||
GlobalConfig.logger.info('fixing plugin {0}'.format(name))
|
||||
if not fix_binary(os.path.join(root, name)):
|
||||
return False
|
||||
return True
|
||||
|
||||
def main():
|
||||
"""
|
||||
script entry point
|
||||
"""
|
||||
descr = """finish the job started by macdeployqt!
|
||||
- find dependencies/rpathes with otool
|
||||
- copy missed dependencies with cp and mkdir
|
||||
- fix missed rpathes with install_name_tool
|
||||
|
||||
exit codes:
|
||||
- 0 : success
|
||||
- 1 : error
|
||||
"""
|
||||
|
||||
parser = argparse.ArgumentParser(description=descr,
|
||||
formatter_class=argparse.RawTextHelpFormatter)
|
||||
parser.add_argument('exepath', help='path to the binary depending on Qt')
|
||||
parser.add_argument('qtpath', help='path of Qt libraries used to build the Qt application')
|
||||
parser.add_argument('-q', '--quiet', action='store_true', default=False,
|
||||
help='do not create log on standard output')
|
||||
parser.add_argument('-nl', '--no-log-file', action='store_true', default=False,
|
||||
help='do not create log file \'./macdeployqtfix.log\'')
|
||||
parser.add_argument('-v', '--verbose', action='store_true', default=False,
|
||||
help='produce more log messages(debug log)')
|
||||
args = parser.parse_args()
|
||||
|
||||
# globals
|
||||
GlobalConfig.qtpath = os.path.normpath(args.qtpath)
|
||||
GlobalConfig.exepath = args.exepath
|
||||
GlobalConfig.logger = logging.getLogger()
|
||||
|
||||
# configure logging
|
||||
###################
|
||||
|
||||
# create formatter
|
||||
formatter = logging.Formatter('%(levelname)s | %(message)s')
|
||||
# create console GlobalConfig.logger
|
||||
if not args.quiet:
|
||||
chdlr = logging.StreamHandler(sys.stdout)
|
||||
chdlr.setFormatter(formatter)
|
||||
GlobalConfig.logger.addHandler(chdlr)
|
||||
|
||||
# create file GlobalConfig.logger
|
||||
if not args.no_log_file:
|
||||
fhdlr = logging.FileHandler('./macdeployqtfix.log', mode='w')
|
||||
fhdlr.setFormatter(formatter)
|
||||
GlobalConfig.logger.addHandler(fhdlr)
|
||||
|
||||
if args.no_log_file and args.quiet:
|
||||
GlobalConfig.logger.addHandler(logging.NullHandler())
|
||||
else:
|
||||
if args.verbose:
|
||||
GlobalConfig.logger.setLevel(logging.DEBUG)
|
||||
else:
|
||||
GlobalConfig.logger.setLevel(logging.INFO)
|
||||
|
||||
if fix_main_binaries():
|
||||
GlobalConfig.logger.info('process terminated with success')
|
||||
sys.exit(0)
|
||||
else:
|
||||
GlobalConfig.logger.error('process terminated with error')
|
||||
sys.exit(1)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user