1SUMMARY="Video editing library used by OpenShot"
2DESCRIPTION="libopenshot is an open-source, cross-platform C++ library \
3dedicated to delivering high quality video editing, animation, and playback \
4solutions to the world. This is the same library which powers \
5OpenShot Video Editor (version 2.0+). C++, Python are fully supported."
6HOMEPAGE="https://www.openshot.org/"
7COPYRIGHT="2008-2023 OpenShot Studios, LLC"
8LICENSE="GNU LGPL v3"
9REVISION="3"
10SOURCE_URI="https://github.com/OpenShot/libopenshot/archive/v$portVersion.tar.gz"
11CHECKSUM_SHA256="58765cfc8aec199814346e97ce31a5618a261260b380670a6fb2bf6f68733638"
12SOURCE_FILENAME="libopenshot-$portVersion.tar.gz"
13PATCHES="libopenshot-$portVersion.patchset"
14
15ARCHITECTURES="all !x86_gcc2"
16SECONDARY_ARCHITECTURES="x86"
17
18PYTHON_VERSION="3.10"
19libVersion="25"
20
21PROVIDES="
22	libopenshot$secondaryArchSuffix = $portVersion
23	lib:libopenshot$secondaryArchSuffix = $libVersion
24	"
25REQUIRES="
26	haiku$secondaryArchSuffix
27	lib:libavcodec$secondaryArchSuffix
28	lib:libavformat$secondaryArchSuffix
29	lib:libavutil$secondaryArchSuffix
30	lib:libbabl_0.1$secondaryArchSuffix
31	lib:libgomp$secondaryArchSuffix
32	lib:libjsoncpp$secondaryArchSuffix
33	lib:liblcms2$secondaryArchSuffix
34	lib:libMagick++_7.Q16HDRI$secondaryArchSuffix
35	lib:libMagickCore_7.Q16HDRI$secondaryArchSuffix
36	lib:libopencv_core$secondaryArchSuffix
37	lib:libopenshot_audio$secondaryArchSuffix
38	lib:libprotobuf$secondaryArchSuffix
39	lib:libQt5Core$secondaryArchSuffix
40	lib:libQt5Gui$secondaryArchSuffix
41	lib:libQt5Widgets$secondaryArchSuffix
42	lib:libswresample$secondaryArchSuffix
43	lib:libswscale$secondaryArchSuffix
44	lib:libzmq$secondaryArchSuffix
45	"
46
47PROVIDES_devel="
48	libopenshot${secondaryArchSuffix}_devel = $portVersion compat >= 0
49	devel:libopenshot${secondaryArchSuffix} = $libVersion
50	"
51REQUIRES_devel="
52	libopenshot$secondaryArchSuffix == $portVersion base
53	"
54
55SUMMARY_python310="$SUMMARY (python3 bindings)"
56PROVIDES_python310="
57	libopenshot${secondaryArchSuffix}_python310 = $portVersion
58	"
59REQUIRES_python310="
60	libopenshot$secondaryArchSuffix == $portVersion base
61	lib:libavutil$secondaryArchSuffix
62	lib:libopenshot_audio$secondaryArchSuffix
63	lib:libpython${PYTHON_VERSION}$secondaryArchSuffix
64	"
65
66if [ "$targetArchitecture" = "x86_gcc2" ]; then
67	PROVIDES_python310+="
68		libopenshot_python310 = $portVersion
69		"
70fi
71
72SUMMARY_python310_debuginfo="$SUMMARY (python3 bindings debug info)"
73PROVIDES_python310_debuginfo="
74	libopenshot${secondaryArchSuffix}_python310_debuginfo = $portVersion
75	debuginfo:_openshot.so(libopenshot_python310) = $portVersion
76	"
77REQUIRES_python310_debuginfo="
78	libopenshot${secondaryArchSuffix}_python310 == $portVersion base
79	"
80
81BUILD_REQUIRES="
82	haiku${secondaryArchSuffix}_devel
83	unittest++${secondaryArchSuffix}_devel
84	devel:libavcodec$secondaryArchSuffix >= 59
85	devel:libavdevice$secondaryArchSuffix >= 59
86	devel:libavformat$secondaryArchSuffix >= 59
87	devel:libavutil$secondaryArchSuffix >= 57
88	devel:libbabl_0.1$secondaryArchSuffix
89	devel:libexecinfo$secondaryArchSuffix
90	devel:libjsoncpp$secondaryArchSuffix
91	devel:liblcms2$secondaryArchSuffix
92	devel:libMagick++_7.Q16HDRI$secondaryArchSuffix
93	devel:libopencv_core$secondaryArchSuffix
94	devel:libopenshot_audio$secondaryArchSuffix
95	devel:libprotobuf$secondaryArchSuffix
96	devel:libQt5Core$secondaryArchSuffix
97	devel:libQt5Gui$secondaryArchSuffix
98	devel:libQt5Multimedia$secondaryArchSuffix
99	devel:libQt5MultimediaWidgets$secondaryArchSuffix
100	devel:libswresample$secondaryArchSuffix >= 4
101	devel:libswscale$secondaryArchSuffix >= 6
102	devel:libzmq$secondaryArchSuffix
103	devel:libz$secondaryArchSuffix
104	"
105BUILD_PREREQUIRES="
106	cmd:cmake
107	cmd:gcc$secondaryArchSuffix
108	cmd:ld$secondaryArchSuffix
109	cmd:make
110	cmd:pkg_config$secondaryArchSuffix
111	cmd:python${PYTHON_VERSION}
112	cmd:swig
113	"
114
115defineDebugInfoPackage libopenshot$secondaryArchSuffix \
116	$libDir/libopenshot.so.$portVersion
117
118BUILD()
119{
120	python=$portPackageLinksDir/cmd~python${PYTHON_VERSION}/bin/python${PYTHON_VERSION}
121	pythonVersion=$($python --version 2>&1 | sed 's/Python //' | head -c4)
122	installLocation=$prefix/lib/python$pythonVersion/vendor-packages/
123
124	export LDFLAGS="-Wl,--as-needed" # Trim unneeded links
125
126	cmake . $cmakeDirArgs \
127		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
128		-DLIBOPENSHOT_AUDIO_INCLUDE_DIR=/system/$relativeIncludeDir/libopenshot-audio/JuceLibraryCode \
129		-DProtobuf_IMPORT_DIRS=/system/$relativeIncludeDir \
130		-DPYTHON_MODULE_PATH=$installLocation \
131		-DENABLE_OPENCV=ON \
132		-DENABLE_RUBY=OFF \
133		-DENABLE_TESTS=OFF \
134		-DENABLE_DOCS=OFF \
135		-DUSE_HW_ACCEL=OFF \
136		-DUSE_SYSTEM_JSONCPP=ON
137
138	make $jobArgs
139}
140
141INSTALL()
142{
143	make install
144	prepareInstalledDevelLibs libopenshot
145
146	# devel package
147	packageEntries devel \
148		$developDir
149
150	python=$portPackageLinksDir/cmd~python${PYTHON_VERSION}/bin/python${PYTHON_VERSION}
151	pythonVersion=$($python --version 2>&1 | sed 's/Python //' | head -c4)
152	pythonLocation=$prefix/lib/python$pythonVersion
153	installLocation=$pythonLocation/vendor-packages
154	pythonDebugInfoDir=$(getPackagePrefix python310_debuginfo)/$relativeDebugInfoDir
155	mkdir -p $pythonLocation
156	extractDebugInfo $installLocation/_openshot.so \
157		"$pythonDebugInfoDir/_openshot.so(libopenshot_python310-$portFullVersion).debuginfo"
158	# python package
159	packageEntries python310 \
160		$pythonLocation
161}
162
163TEST()
164{
165	make $jobArgs test
166}
167