libopenshot: add recipe for version 0.1.1

* our gcc doesn't have openmp ATM, so the patch disables
most of it.
* unit tests are disabled, lack of dev-libs/unittest++.
* hardcoded search directory for libopenshot-audio headers.
This commit is contained in:
Jerome Duval
2016-06-02 09:48:48 +02:00
parent 0ebf1089be
commit 918196ab01
2 changed files with 404 additions and 0 deletions

View File

@@ -0,0 +1,92 @@
SUMMARY="Video editing library used by OpenShot"
DESCRIPTION="libopenshot is an open-source, cross-platform C++ library dedicated to \
delivering high quality video editing, animation, and playback solutions to \
the world. This is the same library which powers OpenShot Video Editor \
(version 2.0+). C++, Python are fully supported."
HOMEPAGE="http://www.openshot.org"
COPYRIGHT="2008-2016 OpenShot Studios, LLC"
LICENSE="GNU LGPL v3"
SOURCE_URI="https://github.com/OpenShot/libopenshot/archive/v$portVersion.tar.gz"
SOURCE_FILENAME="libopenshot-$portVersion.tar.gz"
CHECKSUM_SHA256="735322c73f6e8ea7bac059970f247c906b4c35f83fad5e5efd9a77adead20d0c"
REVISION="1"
PATCHES="libopenshot-$portVersion.patchset"
ARCHITECTURES="!x86_gcc2 x86 x86_64"
SECONDARY_ARCHITECTURES="!x86_gcc2 x86"
PROVIDES="
libopenshot$secondaryArchSuffix = $portVersion compat >= 0
lib:libopenshot$secondaryArchSuffix = $portVersion compat >= 0
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libavcodec$secondaryArchSuffix
lib:libopenshot_audio$secondaryArchSuffix
lib:libQt5Core$secondaryArchSuffix
lib:libQt5Gui$secondaryArchSuffix
lib:libQt5MultimediaWidgets$secondaryArchSuffix
lib:libQt5Network$secondaryArchSuffix
lib:libQt5Widgets$secondaryArchSuffix
lib:libMagick++_6.Q16$secondaryArchSuffix
"
PROVIDES_devel="
libopenshot${secondaryArchSuffix}_devel = $portVersion compat >= 0
devel:libopenshot${secondaryArchSuffix} = $portVersion compat >= 0
"
REQUIRES_devel="
libopenshot$secondaryArchSuffix == $portVersion base
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
devel:libavcodec$secondaryArchSuffix
devel:libopenshot_audio$secondaryArchSuffix
devel:libQt5Core$secondaryArchSuffix
devel:libQt5Gui$secondaryArchSuffix
devel:libQt5MultimediaWidgets$secondaryArchSuffix
devel:libQt5Network$secondaryArchSuffix
devel:libQt5Widgets$secondaryArchSuffix
devel:libMagick++_6.Q16$secondaryArchSuffix
"
BUILD_PREREQUIRES="
cmd:cmake
cmd:gcc$secondaryArchSuffix
cmd:ld$secondaryArchSuffix
cmd:make
cmd:python3
cmd:swig
"
BUILD()
{
cmake . -DCMAKE_INSTALL_PREFIX=$prefix \
-DENABLE_RUBY=OFF
make $jobArgs
}
INSTALL()
{
make install
prepareInstalledDevelLibs libopenshot
fixPkgconfig
mkdir -p $includeDir
mv $prefix/include/libopenshot $includeDir
rmdir $prefix/include
python=$portPackageLinksDir/cmd~python3/bin/python3
pythonVersion=$($python --version 2>&1 | sed 's/Python //' | head -c3)
installLocation=$prefix/lib/python$pythonVersion/vendor-packages/
mkdir -p $installLocation
# TODO fix install location
mv /python3-*/.self/non-packaged/lib/python3*/site-packages/* $installLocation/
# devel package
packageEntries devel \
$developDir
}

View File

@@ -0,0 +1,312 @@
From 15e385fe34b84b81c9cb834dd05192089de2a769 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Wed, 1 Jun 2016 12:35:16 +0200
Subject: Haiku patch
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1de241a..779bdc6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -77,11 +77,11 @@ FILE(GLOB QT_HEADER_FILES "${QT_HEADER_DIR}/*.h")
############## PROCESS SUB-DIRECTORIES ##############
add_subdirectory(src)
-add_subdirectory(tests)
+#add_subdirectory(tests)
################### DOCUMENTATION ###################
# Find Doxygen (used for documentation)
include(cmake/Modules/UseDoxygen.cmake)
file(GLOB_RECURSE doc_files ${CMAKE_CURRENT_BINARY_DIR}/doc/html/*.*)
-INSTALL(FILES ${doc_files} DESTINATION share/doc/libopenshot)
\ No newline at end of file
+INSTALL(FILES ${doc_files} DESTINATION share/doc/libopenshot)
diff --git a/cmake/Modules/FindOpenShotAudio.cmake b/cmake/Modules/FindOpenShotAudio.cmake
index 720b93a..bca4aee 100644
--- a/cmake/Modules/FindOpenShotAudio.cmake
+++ b/cmake/Modules/FindOpenShotAudio.cmake
@@ -11,7 +11,8 @@ message("$ENV{LIBOPENSHOT_AUDIO_DIR}")
find_path(LIBOPENSHOT_AUDIO_BASE_DIR JuceHeader.h
PATHS /usr/include/libopenshot-audio/
/usr/local/include/libopenshot-audio/
- $ENV{LIBOPENSHOT_AUDIO_DIR}/include/libopenshot-audio/ )
+ $ENV{LIBOPENSHOT_AUDIO_DIR}/include/libopenshot-audio/
+ /system/develop/headers/libopenshot-audio/ )
# Get a list of all header file paths
FILE(GLOB_RECURSE JUCE_HEADER_FILES
diff --git a/include/ChunkReader.h b/include/ChunkReader.h
index dd61257..250d133 100644
--- a/include/ChunkReader.h
+++ b/include/ChunkReader.h
@@ -35,7 +35,9 @@
#include <ctime>
#include <iostream>
#include <fstream>
+#ifndef __HAIKU__
#include <omp.h>
+#endif
#include <QtCore/qdir.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/include/ChunkWriter.h b/include/ChunkWriter.h
index 729713c..01e6607 100644
--- a/include/ChunkWriter.h
+++ b/include/ChunkWriter.h
@@ -36,7 +36,9 @@
#include <ctime>
#include <iostream>
#include <fstream>
+#ifndef __HAIKU__
#include <omp.h>
+#endif
#include <QtCore/qdir.h>
#include <stdio.h>
#include <sstream>
diff --git a/include/DummyReader.h b/include/DummyReader.h
index 73783cf..1cc5182 100644
--- a/include/DummyReader.h
+++ b/include/DummyReader.h
@@ -33,7 +33,9 @@
#include <cmath>
#include <ctime>
#include <iostream>
+#ifndef __HAIKU__
#include <omp.h>
+#endif
#include <stdio.h>
#include <tr1/memory>
#include "Cache.h"
diff --git a/include/ImageReader.h b/include/ImageReader.h
index e51b40a..b836aa0 100644
--- a/include/ImageReader.h
+++ b/include/ImageReader.h
@@ -33,7 +33,9 @@
#include <cmath>
#include <ctime>
#include <iostream>
+#ifndef __HAIKU__
#include <omp.h>
+#endif
#include <stdio.h>
#include <tr1/memory>
#include "Magick++.h"
diff --git a/include/OpenMPUtilities.h b/include/OpenMPUtilities.h
index fc4ff3a..422b90d 100644
--- a/include/OpenMPUtilities.h
+++ b/include/OpenMPUtilities.h
@@ -28,9 +28,14 @@
#ifndef OPENSHOT_OPENMP_UTILITIES_H
#define OPENSHOT_OPENMP_UTILITIES_H
+#ifndef __HAIKU__
#include <omp.h>
// Calculate the # of OpenMP Threads to allow (HACK / WORK-AROUND for an ImageMagick bug: preventing use of all 8 cores)
#define OPEN_MP_NUM_PROCESSORS omp_get_num_procs()
+#else
+ #define OPEN_MP_NUM_PROCESSORS 1
+#endif
+
#endif
diff --git a/include/QtImageReader.h b/include/QtImageReader.h
index 594ef26..c40d38f 100644
--- a/include/QtImageReader.h
+++ b/include/QtImageReader.h
@@ -33,7 +33,9 @@
#include <cmath>
#include <ctime>
#include <iostream>
+#ifndef __HAIKU__
#include <omp.h>
+#endif
#include <stdio.h>
#include <tr1/memory>
#include <QtCore/QString>
diff --git a/include/TextReader.h b/include/TextReader.h
index bb8bdd7..2f4e8cf 100644
--- a/include/TextReader.h
+++ b/include/TextReader.h
@@ -33,7 +33,9 @@
#include <cmath>
#include <ctime>
#include <iostream>
+#ifndef __HAIKU__
#include <omp.h>
+#endif
#include <stdio.h>
#include <tr1/memory>
#include "Magick++.h"
diff --git a/include/effects/Blur.h b/include/effects/Blur.h
index 02799bd..5acc5c9 100644
--- a/include/effects/Blur.h
+++ b/include/effects/Blur.h
@@ -33,7 +33,9 @@
#include <cmath>
#include <ctime>
#include <iostream>
+#ifndef __HAIKU__
#include <omp.h>
+#endif
#include <stdio.h>
#include <tr1/memory>
#include <QRect>
diff --git a/include/effects/Brightness.h b/include/effects/Brightness.h
index 801cf40..6b9dd9b 100644
--- a/include/effects/Brightness.h
+++ b/include/effects/Brightness.h
@@ -33,7 +33,9 @@
#include <cmath>
#include <ctime>
#include <iostream>
+#ifndef __HAIKU__
#include <omp.h>
+#endif
#include <stdio.h>
#include <tr1/memory>
#include "../Color.h"
diff --git a/include/effects/ChromaKey.h b/include/effects/ChromaKey.h
index f2710ad..a216068 100644
--- a/include/effects/ChromaKey.h
+++ b/include/effects/ChromaKey.h
@@ -33,7 +33,9 @@
#include <cmath>
#include <ctime>
#include <iostream>
+#ifndef __HAIKU__
#include <omp.h>
+#endif
#include <stdio.h>
#include <tr1/memory>
#include "../Color.h"
diff --git a/include/effects/Deinterlace.h b/include/effects/Deinterlace.h
index 8210399..1d7257b 100644
--- a/include/effects/Deinterlace.h
+++ b/include/effects/Deinterlace.h
@@ -33,7 +33,9 @@
#include <cmath>
#include <ctime>
#include <iostream>
+#ifndef __HAIKU__
#include <omp.h>
+#endif
#include <stdio.h>
#include <tr1/memory>
#include "../Color.h"
diff --git a/include/effects/Mask.h b/include/effects/Mask.h
index 005ab19..a783fbe 100644
--- a/include/effects/Mask.h
+++ b/include/effects/Mask.h
@@ -33,7 +33,9 @@
#include <cmath>
#include <ctime>
#include <iostream>
+#ifndef __HAIKU__
#include <omp.h>
+#endif
#include <stdio.h>
#include <tr1/memory>
#include "../Color.h"
diff --git a/include/effects/Negate.h b/include/effects/Negate.h
index d8a85f2..6fbaadb 100644
--- a/include/effects/Negate.h
+++ b/include/effects/Negate.h
@@ -33,7 +33,9 @@
#include <cmath>
#include <ctime>
#include <iostream>
+#ifndef __HAIKU__
#include <omp.h>
+#endif
#include <stdio.h>
#include <tr1/memory>
#include "../Color.h"
diff --git a/include/effects/Saturation.h b/include/effects/Saturation.h
index 35bff03..19bdd6c 100644
--- a/include/effects/Saturation.h
+++ b/include/effects/Saturation.h
@@ -33,7 +33,9 @@
#include <cmath>
#include <ctime>
#include <iostream>
+#ifndef __HAIKU__
#include <omp.h>
+#endif
#include <stdio.h>
#include <tr1/memory>
#include "../Color.h"
diff --git a/src/FFmpegReader.cpp b/src/FFmpegReader.cpp
index 7bc06ac..a47aa93 100644
--- a/src/FFmpegReader.cpp
+++ b/src/FFmpegReader.cpp
@@ -506,10 +506,12 @@ tr1::shared_ptr<Frame> FFmpegReader::ReadStream(long int requested_frame)
int packets_processed = 0;
int minimum_packets = OPEN_MP_NUM_PROCESSORS;
+#ifndef __HAIKU__
// Set the number of threads in OpenMP
omp_set_num_threads(OPEN_MP_NUM_PROCESSORS);
// Allow nested OpenMP sections
omp_set_nested(true);
+#endif
// Debug output
AppendDebugMethod("FFmpegReader::ReadStream", "requested_frame", requested_frame, "OPEN_MP_NUM_PROCESSORS", OPEN_MP_NUM_PROCESSORS, "", -1, "", -1, "", -1, "", -1);
diff --git a/src/FFmpegWriter.cpp b/src/FFmpegWriter.cpp
index 33745e6..d40c9e1 100644
--- a/src/FFmpegWriter.cpp
+++ b/src/FFmpegWriter.cpp
@@ -398,10 +398,12 @@ void FFmpegWriter::write_queued_frames() throw (ErrorEncodingVideo)
spooled_video_frames.clear();
spooled_audio_frames.clear();
+#ifndef __HAIKU__
// Set the number of threads in OpenMP
omp_set_num_threads(OPEN_MP_NUM_PROCESSORS);
// Allow nested OpenMP sections
omp_set_nested(true);
+#endif
// Create blank exception
bool has_error_encoding_video = false;
diff --git a/src/FrameMapper.cpp b/src/FrameMapper.cpp
index 5b1ac2a..0d24a1d 100644
--- a/src/FrameMapper.cpp
+++ b/src/FrameMapper.cpp
@@ -376,10 +376,12 @@ tr1::shared_ptr<Frame> FrameMapper::GetFrame(long int requested_frame) throw(Rea
// Minimum number of frames to process (for performance reasons)
int minimum_frames = OPEN_MP_NUM_PROCESSORS;
+#ifndef __HAIKU__
// Set the number of threads in OpenMP
omp_set_num_threads(OPEN_MP_NUM_PROCESSORS);
// Allow nested OpenMP sections
omp_set_nested(true);
+#endif
#pragma omp parallel
{
diff --git a/src/Timeline.cpp b/src/Timeline.cpp
index 891d148..205c339 100644
--- a/src/Timeline.cpp
+++ b/src/Timeline.cpp
@@ -627,9 +627,13 @@ tr1::shared_ptr<Frame> Timeline::GetFrame(long int requested_frame) throw(Reader
// This also opens the readers for intersecting clips, and marks non-intersecting clips as 'needs closing'
vector<Clip*> nearby_clips = find_intersecting_clips(requested_frame, minimum_frames, true);
+#ifndef __HAIKU__
omp_set_num_threads(OPEN_MP_NUM_PROCESSORS);
// Allow nested OpenMP sections
omp_set_nested(true);
+#else
+ #define omp_get_thread_num() 1
+#endif
// Debug output
AppendDebugMethod("Timeline::GetFrame", "requested_frame", requested_frame, "minimum_frames", minimum_frames, "OPEN_MP_NUM_PROCESSORS", OPEN_MP_NUM_PROCESSORS, "", -1, "", -1, "", -1);
--
2.2.2