Browse Source

ci: fixes

Stéphane L 6 years ago
parent
commit
374d91c95e

+ 4 - 7
.travis.yml

@@ -7,22 +7,19 @@ global:
 matrix:
   include:
   - os: linux
-    env: _linux_build
     dist: trusty
     sudo: required
     services:
     - docker
     before_install:
-    - docker run -d --name xenial -v $(dirname $(pwd)):/root -v /home/travis/package:/package
-      -e TRAVIS_BRANCH="$TRAVIS_BRANCH" -e TRAVIS_TAG="$TRAVIS_TAG" -e PROJECT_NAME="$PROJECT_NAME" -w /root nimmis/ubuntu:16.04
-    - docker exec -it xenial /root/$PROJECT_NAME/CI/linux/install-dependencies-xenial.sh
+    - docker run -d --name xenial -v $(pwd):/repo -v /home/travis/package:/package -e TRAVIS_BRANCH="$TRAVIS_BRANCH" -e TRAVIS_TAG="$TRAVIS_TAG" -e PROJECT_NAME="$PROJECT_NAME" -w /repo nimmis/ubuntu:16.04
+    - docker exec -it xenial /repo/CI/linux/install-dependencies-xenial.sh
     script:
-    - docker exec -it xenial /root/$PROJECT_NAME/CI/linux/build-xenial.sh
+    - docker exec -it xenial /repo/CI/linux/build-xenial.sh
     after_success:
-    - docker exec -it xenial /root/$PROJECT_NAME/CI/linux/package-xenial.sh
+    - docker exec -it xenial /repo/CI/linux/package-xenial.sh
 
   - os: osx
-    env: _macos_build
     osx_image: xcode8.3
     before_install: "./CI/macos/install-dependencies-macos.sh"
     script: "./CI/macos/build-macos.sh"

+ 0 - 2
CI/linux/build-xenial.sh

@@ -1,8 +1,6 @@
 #!/bin/sh
 set -ex
 
-cd /root/$PROJECT_NAME
-
 mkdir build && cd build
 cmake -DCMAKE_INSTALL_PREFIX=/usr ..
 make -j4

+ 1 - 1
CI/linux/install-dependencies-xenial.sh

@@ -11,7 +11,7 @@ apt-get install -y \
 	checkinstall \
 	cmake \
 	obs-studio \
-	libqt5websockets5-dev
+    qtbase5-dev
 
 # Dirty hack
 wget -O /usr/include/obs/obs-frontend-api.h https://raw.githubusercontent.com/obsproject/obs-studio/master/UI/obs-frontend-api/obs-frontend-api.h

+ 1 - 3
CI/linux/package-xenial.sh

@@ -2,8 +2,6 @@
 
 set -e
 
-cd /root/$PROJECT_NAME
-
 export GIT_HASH=$(git rev-parse --short HEAD)
 export PKG_VERSION="1-$GIT_HASH-$TRAVIS_BRANCH-git"
 
@@ -11,7 +9,7 @@ if [ -n "${TRAVIS_TAG}" ]; then
 	export PKG_VERSION="$TRAVIS_TAG"
 fi
 
-cd /root/$PROJECT_NAME/build
+cd build
 
 PAGER=cat checkinstall -y --type=debian --fstrans=no --nodoc \
 	--backup=no --deldoc=yes --install=no \

+ 1 - 1
CI/macos/build-macos.sh

@@ -7,7 +7,7 @@ brew install ffmpeg
 brew install libav
 
 # qt 5.9.2
-brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/2b121c9a96e58a5da14228630cb71d5bead7137e/Formula/qt.rb
+brew install ./CI/macos/qt.rb
 
 # Build obs-studio
 cd ..

+ 163 - 0
CI/macos/package-macos.sh

@@ -0,0 +1,163 @@
+# Patches for Qt must be at the very least submitted to Qt's Gerrit codereview
+# rather than their bug-report Jira. The latter is rarely reviewed by Qt.
+class Qt < Formula
+	desc "Cross-platform application and UI framework"
+	homepage "https://www.qt.io/"
+	url "https://download.qt.io/archive/qt/5.10/5.10.1/single/qt-everywhere-src-5.10.1.tar.xz"
+	mirror "https://mirrorservice.org/sites/download.qt-project.org/official_releases/qt/5.10/5.10.1/single/qt-everywhere-src-5.10.1.tar.xz"
+	sha256 "05ffba7b811b854ed558abf2be2ddbd3bb6ddd0b60ea4b5da75d277ac15e740a"
+	head "https://code.qt.io/qt/qt5.git", :branch => "5.10.1", :shallow => false
+
+	bottle do
+		sha256 "8b4bad005596a5f8790150fe455db998ac2406f4e0f04140d6656205d844d266" => :high_sierra
+		sha256 "9c488554935fb573554a4e36d36d3c81e47245b7fefc4b61edef894e67ba1740" => :sierra
+		sha256 "c0407afba5951df6cc4c6f6c1c315972bd41c99cecb4e029919c4c15ab6f7bdc" => :el_capitan
+	end
+
+	keg_only "Qt 5 has CMake issues when linked"
+
+	option "with-docs", "Build documentation"
+	option "with-examples", "Build examples"
+
+	deprecated_option "with-mysql" => "with-mysql-client"
+
+	# OS X 10.7 Lion is still supported in Qt 5.5, but is no longer a reference
+	# configuration and thus untested in practice. Builds on OS X 10.7 have been
+	# reported to fail: <https://github.com/Homebrew/homebrew/issues/45284>.
+	depends_on :macos => :mountain_lion
+
+	depends_on "pkg-config" => :build
+	depends_on :xcode => :build
+	depends_on "mysql-client" => :optional
+	depends_on "postgresql" => :optional
+
+	# Restore `.pc` files for framework-based build of Qt 5 on OS X. This
+	# partially reverts <https://codereview.qt-project.org/#/c/140954/> merged
+	# between the 5.5.1 and 5.6.0 releases. (Remove this as soon as feasible!)
+	#
+	# Core formulae known to fail without this patch (as of 2016-10-15):
+	#   * gnuplot  (with `--with-qt` option)
+	#   * mkvtoolnix (with `--with-qt` option, silent build failure)
+	#   * poppler    (with `--with-qt` option)
+	patch do
+		url "https://raw.githubusercontent.com/Homebrew/formula-patches/e8fe6567/qt5/restore-pc-files.patch"
+		sha256 "48ff18be2f4050de7288bddbae7f47e949512ac4bcd126c2f504be2ac701158b"
+	end
+
+	# Fix compile error on macOS 10.13 around QFixed:
+	# https://github.com/Homebrew/homebrew-core/issues/27095
+	# https://bugreports.qt.io/browse/QTBUG-67545
+	patch do
+		url "https://raw.githubusercontent.com/z00m1n/formula-patches/0de0e229/qt/QTBUG-67545.patch"
+		sha256 "4a115097c7582c7dce4207f5500d13feb8c990eb8a05a43f41953985976ebe6c"
+	end
+
+	# Fix compile error on macOS 10.13 caused by qtlocation dependency
+	# mapbox-gl-native using Boost 1.62.0 does not build with C++ 17:
+	# https://github.com/Homebrew/homebrew-core/issues/27095
+	# https://bugreports.qt.io/browse/QTBUG-67810
+	patch do
+		url "https://raw.githubusercontent.com/z00m1n/formula-patches/a1a1f0dd/qt/QTBUG-67810.patch"
+		sha256 "8ee0bf71df1043f08ebae3aa35036be29c4d9ebff8a27e3b0411a6bd635e9382"
+	end
+
+	def install
+		args = %W[
+			-verbose
+			-prefix #{prefix}
+			-release
+			-opensource -confirm-license
+			-system-zlib
+			-qt-libpng
+			-qt-libjpeg
+			-qt-freetype
+			-qt-pcre
+			-nomake tests
+			-no-rpath
+			-pkg-config
+			-dbus-runtime
+			-no-assimp
+		]
+
+		args << "-nomake" << "examples" if build.without? "examples"
+
+		if build.with? "mysql-client"
+			args << "-plugin-sql-mysql"
+			(buildpath/"brew_shim/mysql_config").write <<~EOS
+				#!/bin/sh
+				if [ x"$1" = x"--libs" ]; then
+					mysql_config --libs | sed "s/-lssl -lcrypto//"
+				else
+					exec mysql_config "$@"
+				fi
+			EOS
+			chmod 0755, "brew_shim/mysql_config"
+			args << "-mysql_config" << buildpath/"brew_shim/mysql_config"
+		end
+
+		args << "-plugin-sql-psql" if build.with? "postgresql"
+
+		system "./configure", *args
+		system "make"
+		ENV.deparallelize
+		system "make", "install"
+
+		if build.with? "docs"
+			system "make", "docs"
+			system "make", "install_docs"
+		end
+
+		# Some config scripts will only find Qt in a "Frameworks" folder
+		frameworks.install_symlink Dir["#{lib}/*.framework"]
+
+		# The pkg-config files installed suggest that headers can be found in the
+		# `include` directory. Make this so by creating symlinks from `include` to
+		# the Frameworks' Headers folders.
+		Pathname.glob("#{lib}/*.framework/Headers") do |path|
+			include.install_symlink path => path.parent.basename(".framework")
+		end
+
+		# Move `*.app` bundles into `libexec` to expose them to `brew linkapps` and
+		# because we don't like having them in `bin`.
+		# (Note: This move breaks invocation of Assistant via the Help menu
+		# of both Designer and Linguist as that relies on Assistant being in `bin`.)
+		libexec.mkpath
+		Pathname.glob("#{bin}/*.app") { |app| mv app, libexec }
+	end
+
+	def caveats; <<~EOS
+		We agreed to the Qt opensource license for you.
+		If this is unacceptable you should uninstall.
+		EOS
+	end
+
+	test do
+		(testpath/"hello.pro").write <<~EOS
+			QT       += core
+			QT       -= gui
+			TARGET = hello
+			CONFIG   += console
+			CONFIG   -= app_bundle
+			TEMPLATE = app
+			SOURCES += main.cpp
+		EOS
+
+		(testpath/"main.cpp").write <<~EOS
+			#include <QCoreApplication>
+			#include <QDebug>
+
+			int main(int argc, char *argv[])
+			{
+				QCoreApplication a(argc, argv);
+				qDebug() << "Hello World!";
+				return 0;
+			}
+		EOS
+
+		system bin/"qmake", testpath/"hello.pro"
+		system "make"
+		assert_predicate testpath/"hello", :exist?
+		assert_predicate testpath/"main.o", :exist?
+		system "./hello"
+	end
+end

+ 1 - 1
CMakeLists.txt

@@ -12,6 +12,7 @@ endif()
 
 find_package(LibObs REQUIRED)
 find_package(Qt5Core REQUIRED)
+find_package(Qt5Widgets REQUIRED)
 
 set(PLUGIN_SOURCES
 	src/plugin-main.c)
@@ -100,7 +101,6 @@ endif()
 if(UNIX AND NOT APPLE)
 	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
 
-	target_compile_options(mbedcrypto PRIVATE -fPIC)
 	set_target_properties(obs-plugintemplate PROPERTIES PREFIX "")
 	target_link_libraries(obs-plugintemplate
 		obs-frontend-api)

+ 9 - 10
appveyor.yml

@@ -1,5 +1,6 @@
 environment:
   CURL_VERSION: 7.39.0
+  PROJECT_NAME: "obs-plugintemplate"
 
 install:
   - git submodule update --init --recursive
@@ -8,10 +9,10 @@ install:
   - 7z x dependencies2015.zip -odependencies2015
   - set DepsPath32=%CD%\dependencies2015\win32
   - set DepsPath64=%CD%\dependencies2015\win64
-  - call C:\projects\%APPVEYOR_PROJECT_NAME%\CI\install-setup-qt.cmd
+  - call C:\projects\%PROJECT_NAME%\CI\win\install-setup-qt.cmd
   - set build_config=Release
-  - call C:\projects\%APPVEYOR_PROJECT_NAME%\CI\install-build-obs.cmd
-  - cd C:\projects\%APPVEYOR_PROJECT_NAME%\
+  - call C:\projects\%PROJECT_NAME%\CI\win\install-build-obs.cmd
+  - cd C:\projects\%PROJECT_NAME%\
   - mkdir build32
   - mkdir build64
   - cd ./build32
@@ -20,17 +21,15 @@ install:
   - cmake -G "Visual Studio 14 2015 Win64" -DQTDIR="%QTDIR64%" -DLibObs_DIR="C:\projects\obs-studio\build64\libobs" -DLIBOBS_INCLUDE_DIR="C:\projects\obs-studio\libobs" -DLIBOBS_LIB="C:\projects\obs-studio\build64\libobs\%build_config%\obs.lib" -DOBS_FRONTEND_LIB="C:\projects\obs-studio\build64\UI\obs-frontend-api\%build_config%\obs-frontend-api.lib" ..
 
 build_script:
-  - call msbuild /m /p:Configuration=%build_config% C:\projects\%APPVEYOR_PROJECT_NAME%\build32\%APPVEYOR_PROJECT_NAME%.sln /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
-  - call msbuild /m /p:Configuration=%build_config% C:\projects\%APPVEYOR_PROJECT_NAME%\build64\%APPVEYOR_PROJECT_NAME%.sln /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
+  - call msbuild /m /p:Configuration=%build_config% C:\projects\%PROJECT_NAME%\build32\%PROJECT_NAME%.sln /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
+  - call msbuild /m /p:Configuration=%build_config% C:\projects\%PROJECT_NAME%\build64\%PROJECT_NAME%.sln /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
 
 before_deploy:
-  - 7z a "C:\projects\%APPVEYOR_PROJECT_NAME%\build.zip" C:\projects\%APPVEYOR_PROJECT_NAME%\release\*
-  - set PATH=%PATH%;"C:\\Program Files (x86)\\Inno Setup 5"
-  - iscc "C:\projects\%APPVEYOR_PROJECT_NAME%\installer\installer-Windows.iss"
+  - 7z a "C:\projects\%PROJECT_NAME%\build.zip" C:\projects\%PROJECT_NAME%\release\*
 
 deploy_script:
-  - ps: Push-AppveyorArtifact "C:\projects\%APPVEYOR_PROJECT_NAME%\build.zip" -FileName "%APPVEYOR_PROJECT_NAME%-$(git log --pretty=format:'%h' -n 1)-Windows.zip"
-  - ps: Push-AppveyorArtifact "C:\projects\%APPVEYOR_PROJECT_NAME%\installer\Output\%APPVEYOR_PROJECT_NAME%-git-Windows-Installer.exe" -FileName "%APPVEYOR_PROJECT_SLUG%-$(git log --pretty=format:'%h' -n 1)-Windows-Installer.exe"
+  - ps: Push-AppveyorArtifact "C:\projects\%PROJECT_NAME%\build.zip" -FileName "%PROJECT_NAME%-$(git log --pretty=format:'%h' -n 1)-Windows.zip"
+  - ps: Push-AppveyorArtifact "C:\projects\%PROJECT_NAME%\installer\Output\%PROJECT_NAME%-git-Windows-Installer.exe" -FileName "%APPVEYOR_PROJECT_SLUG%-$(git log --pretty=format:'%h' -n 1)-Windows-Installer.exe"
 
 test: off
 

+ 1 - 1
installer/installer-Windows.iss

@@ -1,5 +1,5 @@
 #define MyAppName "obs-plugintemplate"
-#define MyAppVersion "latest"
+#define MyAppVersion "0.1.0"
 #define MyAppPublisher "Developer Name"
 #define MyAppURL "http://www.mywebsite.com"
 

+ 2 - 1
src/plugin-macros.h

@@ -19,6 +19,7 @@ with this program. If not, see <https://www.gnu.org/licenses/>
 #ifndef PLUGINNAME_H
 #define PLUGINNAME_H
 
-#define blog(level, msg, ...) blog(level, "[Plugin Name] " msg, ##__VA_ARGS__)
+#define MY_PLUGIN_NAME "obs-plugintemplate"
+#define blog(level, msg, ...) blog(level, "[" MY_PLUGIN_NAME "] " msg, ##__VA_ARGS__)
 
 #endif // PLUGINNAME_H

+ 3 - 0
src/plugin-main.c

@@ -18,7 +18,10 @@ with this program. If not, see <https://www.gnu.org/licenses/>
 
 #include <obs-module.h>
 
+#include "plugin-macros.h"
+
 OBS_DECLARE_MODULE()
+OBS_MODULE_USE_DEFAULT_LOCALE(MY_PLUGIN_NAME, "en-US")
 
 bool obs_module_load(void)
 {