diff --git a/qgroundcontrol.pro b/qgroundcontrol.pro index 5192939ef249cc62da41bbd7d2b4426826d3fec5..b8b83f0dfab1c9515941be96bdcc696f0c58eed2 100644 --- a/qgroundcontrol.pro +++ b/qgroundcontrol.pro @@ -65,7 +65,15 @@ LinuxBuild { CONFIG += qt \ thread \ c++11 \ + +contains(DEFINES, ENABLE_VERBOSE_OUTPUT) { + message("Enable verbose compiler output (manual override from command line)") +} else:exists(user_config.pri):infile(user_config.pri, DEFINES, ENABLE_VERBOSE_OUTPUT) { + message("Enable verbose compiler output (manual override from user_config.pri)") +} else { +CONFIG += \ silent +} QT += \ concurrent \ diff --git a/src/VideoStreaming/VideoStreaming.cc b/src/VideoStreaming/VideoStreaming.cc index 2332177a9f92b3b066ba693bd3fb73a4cddefe39..12ecf3019a07133de20ff484c9575125cccc69ed 100644 --- a/src/VideoStreaming/VideoStreaming.cc +++ b/src/VideoStreaming/VideoStreaming.cc @@ -69,41 +69,35 @@ static void qgcputenv(const QString& key, const QString& root, const QString& pa void initializeVideoStreaming(int &argc, char* argv[]) { #if defined(QGC_GST_STREAMING) - // Initialize GStreamer - GError* error = NULL; - if (!gst_init_check(&argc, &argv, &error)) { - qCritical() << "gst_init_check() failed: " << error->message; - g_error_free(error); - } - // Our own plugin - GST_PLUGIN_STATIC_REGISTER(QGC_VIDEOSINK_PLUGIN); - // The static plugins we use -#if defined(__mobile__) - GST_PLUGIN_STATIC_REGISTER(coreelements); - GST_PLUGIN_STATIC_REGISTER(libav); - GST_PLUGIN_STATIC_REGISTER(rtp); - GST_PLUGIN_STATIC_REGISTER(udp); - GST_PLUGIN_STATIC_REGISTER(videoparsersbad); - GST_PLUGIN_STATIC_REGISTER(x264); -#endif - -#ifdef __macos__ -#ifdef QGC_INSTALL_RELEASE - QString currentDir = QCoreApplication::applicationDirPath(); - qgcputenv("GST_PLUGIN_SCANNER", currentDir, "/gst-plugin-scanner"); - qgcputenv("GTK_PATH", currentDir, "/../Frameworks/GStreamer.framework/Versions/Current"); - qgcputenv("GIO_EXTRA_MODULES", currentDir, "/../Frameworks/GStreamer.framework/Versions/Current/lib/gio/modules"); - qgcputenv("GST_PLUGIN_SYSTEM_PATH_1_0", currentDir, "/../Frameworks/GStreamer.framework/Versions/Current/lib/gstreamer-1.0"); - qgcputenv("GST_PLUGIN_SYSTEM_PATH", currentDir, "/../Frameworks/GStreamer.framework/Versions/Current/lib/gstreamer-1.0"); - qgcputenv("GST_PLUGIN_PATH_1_0", currentDir, "/../Frameworks/GStreamer.framework/Versions/Current/lib/gstreamer-1.0"); - qgcputenv("GST_PLUGIN_PATH", currentDir, "/../Frameworks/GStreamer.framework/Versions/Current/lib/gstreamer-1.0"); -// QStringList env = QProcessEnvironment::systemEnvironment().keys(); -// foreach(const QString &key, env) { -// qDebug() << key << QProcessEnvironment::systemEnvironment().value(key); -// } -#endif -#endif - + #ifdef __macos__ + #ifdef QGC_INSTALL_RELEASE + QString currentDir = QCoreApplication::applicationDirPath(); + qgcputenv("GST_PLUGIN_SCANNER", currentDir, "/../Frameworks/GStreamer.framework/Versions/1.0/libexec/gstreamer-1.0/gst-plugin-scanner"); + qgcputenv("GTK_PATH", currentDir, "/../Frameworks/GStreamer.framework/Versions/Current"); + qgcputenv("GIO_EXTRA_MODULES", currentDir, "/../Frameworks/GStreamer.framework/Versions/Current/lib/gio/modules"); + qgcputenv("GST_PLUGIN_SYSTEM_PATH_1_0", currentDir, "/../Frameworks/GStreamer.framework/Versions/Current/lib/gstreamer-1.0"); + qgcputenv("GST_PLUGIN_SYSTEM_PATH", currentDir, "/../Frameworks/GStreamer.framework/Versions/Current/lib/gstreamer-1.0"); + qgcputenv("GST_PLUGIN_PATH_1_0", currentDir, "/../Frameworks/GStreamer.framework/Versions/Current/lib/gstreamer-1.0"); + qgcputenv("GST_PLUGIN_PATH", currentDir, "/../Frameworks/GStreamer.framework/Versions/Current/lib/gstreamer-1.0"); + #endif + #endif + // Initialize GStreamer + GError* error = NULL; + if (!gst_init_check(&argc, &argv, &error)) { + qCritical() << "gst_init_check() failed: " << error->message; + g_error_free(error); + } + // Our own plugin + GST_PLUGIN_STATIC_REGISTER(QGC_VIDEOSINK_PLUGIN); + // The static plugins we use + #if defined(__mobile__) + GST_PLUGIN_STATIC_REGISTER(coreelements); + GST_PLUGIN_STATIC_REGISTER(libav); + GST_PLUGIN_STATIC_REGISTER(rtp); + GST_PLUGIN_STATIC_REGISTER(udp); + GST_PLUGIN_STATIC_REGISTER(videoparsersbad); + GST_PLUGIN_STATIC_REGISTER(x264); + #endif #else Q_UNUSED(argc); Q_UNUSED(argv); diff --git a/tools/osxrelocator.py b/tools/osxrelocator.py index 4a36687d7f5c03289987f2b1468e793a1edeef74..6090ef91b1ff7710eb0b3590912525c01fabe6a9 100755 --- a/tools/osxrelocator.py +++ b/tools/osxrelocator.py @@ -26,7 +26,7 @@ OTOOL_CMD = 'otool' def shell_call(cmd, cmd_dir='.', fail=True): - print "call", cmd + #print("call", cmd) try: ret = subprocess.check_call( cmd, cwd=cmd_dir, @@ -40,7 +40,7 @@ def shell_call(cmd, cmd_dir='.', fail=True): def shell_check_call(cmd): - print "ccall", cmd + #print("ccall", cmd) try: process = subprocess.Popen( cmd, stdout=subprocess.PIPE) @@ -54,6 +54,7 @@ class OSXRelocator(object): ''' Wrapper for OS X's install_name_tool and otool commands to help relocating shared libraries. + It parses lib/ /libexec and bin/ directories, changes the prefix path of the shared libraries that an object file uses and changes it's library ID if the file is a shared library. @@ -61,19 +62,19 @@ class OSXRelocator(object): def __init__(self, root, lib_prefix, new_lib_prefix, recursive): self.root = root - self.lib_prefix = self._fix_path(lib_prefix) - self.new_lib_prefix = self._fix_path(new_lib_prefix) + self.lib_prefix = self._fix_path(lib_prefix).encode('utf-8') + self.new_lib_prefix = self._fix_path(new_lib_prefix).encode('utf-8') self.recursive = recursive def relocate(self): - self.parse_dir(self.root, filters=['', '.dylib', '.so', '0']) + self.parse_dir(self.root, filters=['', '.dylib', '.so']) def relocate_file(self, object_file, id=None): self.change_libs_path(object_file) self.change_id(object_file, id) def change_id(self, object_file, id=None): - id = id or object_file.replace(self.lib_prefix, self.new_lib_prefix) + id = id or object_file.replace(self.lib_prefix.decode('utf-8'), self.new_lib_prefix.decode('utf-8')) filename = os.path.basename(object_file) if not (filename.endswith('so') or filename.endswith('dylib')): return @@ -105,13 +106,13 @@ class OSXRelocator(object): @staticmethod def list_shared_libraries(object_file): cmd = [OTOOL_CMD, "-L", object_file] - res = shell_check_call(cmd).split('\n') + res = shell_check_call(cmd).split(b'\n') # We don't use the first line libs = res[1:] # Remove the first character tabulation libs = [x[1:] for x in libs] # Remove the version info - libs = [x.split(' ', 1)[0] for x in libs] + libs = [x.split(b' ', 1)[0] for x in libs] return libs @staticmethod @@ -157,4 +158,3 @@ def main(): if __name__ == "__main__": main() - diff --git a/tools/prepare_gstreamer_framework.sh b/tools/prepare_gstreamer_framework.sh index b149a31349e1b97bd958148f883afdf06b232bef..c1e4993e792b809bf0ded3e2e2f0e26397d89650 100755 --- a/tools/prepare_gstreamer_framework.sh +++ b/tools/prepare_gstreamer_framework.sh @@ -26,6 +26,9 @@ GST_ROOT=/Library/Frameworks/GStreamer.framework GST_BASE=$GST_ROOT/Versions/$GST_VER RELOC=$(dirname $0)/osxrelocator.py +OLDDLPATH=/Library/Frameworks/GStreamer.framework/ +NEWDLPATH=@executable_path/../Frameworks/GStreamer.framework/ + echo "GST Installer" [ "$#" -eq 3 ] || die "3 arguments required, $# provided" [ -d "$2" ] || die "Could not find $2" @@ -46,6 +49,8 @@ process_framework() { rsync -a --delete "$GST_ROOT" "$FMWORK_TARGET" || die "Error copying $GST_ROOT to $FMWORK_TARGET" #-- Prune unused stuff rm -rf $GST_TARGET/bin + rm -rf $GST_TARGET/etc + rm -rf $GST_TARGET/share rm -rf $GST_TARGET/Headers rm -rf $GST_TARGET/include rm -rf $GST_TARGET/lib/*.a @@ -57,32 +62,9 @@ process_framework() { rm -rf $GST_TARGET/lib/libffi-3.0.13 rm -rf $GST_TARGET/lib/pkgconfig rm $GST_TARGET/Commands - #-- Some dylibs are dupes instead of symlinks. - #-- This will do a minimum job in trying to clean those. - #-- Doesn't work. The stupid thing can't load a dlyb symlink. - #for f in $GST_TARGET/lib/*.dylib - #do - # foo=$(basename "$f") - # bar="${foo%.*}" - # for i in `seq 0 9`; - # do - # if [ -e $GST_TARGET/lib/$bar.$i.dylib ]; then - # DUPES="$DUPES - #rm -f $GST_TARGET/lib/$bar.$i.dylib" - # DUPES="$DUPES - #ln -s $f $GST_TARGET/lib/$bar.$i.dylib" - # fi - # done - #done - #IFS=$'\n' - #for c in $DUPES - #do - # eval $c - #done #-- Now relocate the embeded paths echo "GST Installer: Relocating" - python $RELOC -r $GST_TARGET/lib /Library/Frameworks/GStreamer.framework/ @executable_path/../Frameworks/GStreamer.framework/ > /dev/null || die "Error relocating binaries in $GST_TARGET/lib" - python $RELOC -r $GST_TARGET/libexec /Library/Frameworks/GStreamer.framework/ @executable_path/../Frameworks/GStreamer.framework/ > /dev/null || die "Error relocating binaries in $GST_TARGET/libexec" + python $RELOC -r "$GST_TARGET" "$OLDDLPATH" "$NEWDLPATH" > /dev/null || die "Error relocating binaries in $GST_TARGET/lib" } #-- Check and see if we've already processed the framework @@ -91,9 +73,12 @@ echo "GST Installer: Checking $GST_TARGET" #-- Now copy the framework to the app bundle echo "GST Installer: Copying $GST_SOURCE to $BUNDLE_TARGET/Contents/Frameworks/" rsync -a --delete $GST_SOURCE $BUNDLE_TARGET/Contents/Frameworks/ || die "Error copying framework into app bundle" -#-- Move this gst binary to MacOS -mv $BUNDLE_TARGET/Contents/Frameworks/GStreamer.framework/Versions/1.0/libexec/gstreamer-1.0/gst-plugin-scanner $BUNDLE_TARGET/Contents/MacOS/ || die "Error moving gst-plugin-scanner" +#-- The plugin scanner needs to find the GStreamer libraries +GSTINBUNDLE=$BUNDLE_TARGET/Contents/Frameworks/GStreamer.framework/Versions/$GST_VER +pushd $GSTINBUNDLE/libexec && ln -sf ../../../../../Frameworks . && popd || die "Error creating Frameworks symlink in $GST_TARGET/libexec" #-- Fix main binary -python $RELOC $QGC_BINARY /Library/Frameworks/GStreamer.framework/ @executable_path/../Frameworks/GStreamer.framework/ > /dev/null || die "Error relocating $QGC_BINARY" +install_name_tool -change /Library/Frameworks/GStreamer.framework/Versions/1.0/lib/GStreamer @executable_path/../Frameworks/GStreamer.framework/Versions/1.0/lib/GStreamer "$QGC_BINARY" > /dev/null || die "Error relocating $QGC_BINARY" +pushd $GSTINBUNDLE && install_name_tool -id @executable_path/../Frameworks/GStreamer.framework/Versions/1.0/lib/GStreamer GStreamer && popd || die "Error relocating GStreamer" +