ccextractor: new recipe (#2090)

This commit is contained in:
Xiang Fan
2018-01-10 14:05:33 +08:00
committed by Jérôme Duval
parent f7ab72e0e0
commit e5b296caeb
2 changed files with 139 additions and 0 deletions

View File

@@ -0,0 +1,52 @@
SUMMARY="A tool used to produce subtitles for TV recordings"
DESCRIPTION="CCExtractor is a tool used to produce subtitles for TV \
recordings from almost anywhere in the world."
HOMEPAGE="https://www.ccextractor.org/"
COPYRIGHT="2017 Carlos Fernandez and others"
LICENSE="GNU GPL v2"
REVISION="1"
SOURCE_URI="https://downloads.sourceforge.net/ccextractor/ccextractor-src-nowin.$portVersion.zip"
CHECKSUM_SHA256="2ac21c6483e206a796d26d6adb7e969eb038a97ead9e2b2a7ee91b8b08c6882e"
SOURCE_DIR="ccextractor"
PATCHES="ccextractor-$portVersion.patchset"
ARCHITECTURES="?x86_gcc2 ?x86 x86_64"
PROVIDES="
ccextractor = $portVersion
cmd:ccextractor = $portVersion
"
REQUIRES="
haiku
lib:libcurl
lib:libiconv
lib:liblept
lib:libtesseract
"
BUILD_REQUIRES="
haiku_devel
devel:libcurl
devel:libiconv
devel:liblept
devel:libtesseract
"
BUILD_PREREQUIRES="
cmd:find
cmd:g++
cmd:gcc
cmd:ld
"
BUILD()
{
cd linux
chmod +x ./*.sh
sh ./build
}
INSTALL()
{
install -d $binDir
install linux/ccextractor $binDir
}

View File

@@ -0,0 +1,87 @@
From e3c0248b02899a0be0fa95a9d395c99526e00fa8 Mon Sep 17 00:00:00 2001
From: sfanxiang <sfanxiang@gmail.com>
Date: Mon, 8 Jan 2018 18:08:11 +0000
Subject: port to Haiku
diff --git a/linux/build b/linux/build
index 6897901..f3e740f 100644
--- a/linux/build
+++ b/linux/build
@@ -1,6 +1,7 @@
#!/bin/bash
+INCLUDE_DIR=$(finddir B_SYSTEM_HEADERS_DIRECTORY)
BLD_FLAGS="-g -std=gnu99 -Wno-write-strings -DGPAC_CONFIG_LINUX -D_FILE_OFFSET_BITS=64 -DVERSION_FILE_PRESENT -DENABLE_OCR"
-BLD_INCLUDE="-I../src -I /usr/include/leptonica/ -I /usr/include/tesseract/ -I../src/lib_ccx/ -I../src/gpacmp4/ -I../src/libpng/ -I../src/zlib/ -I../src/zvbi -I../src/lib_hash -I../src/protobuf-c -I../src/utf8proc"
+BLD_INCLUDE="-I../src -I $INCLUDE_DIR/leptonica/ -I $INCLUDE_DIR/tesseract/ -I../src/lib_ccx/ -I../src/gpacmp4/ -I../src/libpng/ -I../src/zlib/ -I../src/zvbi -I../src/lib_hash -I../src/protobuf-c -I../src/utf8proc"
SRC_LIBPNG="$(find ../src/libpng/ -name '*.c')"
SRC_ZLIB="$(find ../src/zlib/ -name '*.c')"
SRC_ZVBI="$(find ../src/zvbi/ -name '*.c')"
@@ -10,7 +11,7 @@ SRC_HASH="$(find ../src/lib_hash/ -name '*.c')"
SRC_PROTOBUF="$(find ../src/protobuf-c/ -name '*.c')"
SRC_UTF8PROC="../src/utf8proc/utf8proc.c"
BLD_SOURCES="../src/ccextractor.c $SRC_CCX $SRC_GPAC $SRC_ZLIB $SRC_ZVBI $SRC_LIBPNG $SRC_HASH $SRC_PROTOBUF $SRC_UTF8PROC"
-BLD_LINKER="-lm -zmuldefs -l tesseract -l lept"
+BLD_LINKER="-liconv -lnetwork -lm -zmuldefs -l tesseract -l lept"
./pre-build.sh
diff --git a/src/gpacmp4/os_file.c b/src/gpacmp4/os_file.c
index 901e292..021c841 100644
--- a/src/gpacmp4/os_file.c
+++ b/src/gpacmp4/os_file.c
@@ -50,6 +50,14 @@
#include <errno.h>
#endif
+#ifdef __HAIKU__
+typedef off_t off64_t;
+
+#define ftello64(stream) ftello(stream)
+#define fseeko64(stream, offset, whence) fseeko(stream, offset, whence)
+#define fopen64(filename, type) fopen(filename, type)
+#endif
+
#endif
diff --git a/src/lib_ccx/ocr.c b/src/lib_ccx/ocr.c
index ebd7619..da190ad 100644
--- a/src/lib_ccx/ocr.c
+++ b/src/lib_ccx/ocr.c
@@ -142,8 +142,7 @@ void* init_ocr(int lang_index)
char* pars_vec = strdup("debug_file");
char* pars_values = strdup("/dev/null");
- ret = TessBaseAPIInit4(ctx->api, tessdata_path, lang, ccx_options.ocr_oem, NULL, 0, &pars_vec,
- &pars_values, 1, false);
+ ret = TessBaseAPIInit2(ctx->api, tessdata_path, lang, ccx_options.ocr_oem);
free(pars_vec);
free(pars_values);
diff --git a/src/lib_hash/sha2.h b/src/lib_hash/sha2.h
index 0e143a1..3a72d6b 100644
--- a/src/lib_hash/sha2.h
+++ b/src/lib_hash/sha2.h
@@ -42,9 +42,9 @@
*/
#include <sys/types.h>
-#ifdef _WIN32
+#if defined(_WIN32) || defined(__HAIKU__)
-#include <inttypes.h>
+#include <stdint.h>
#define u_int8_t uint8_t
#define u_int32_t uint32_t
@@ -190,4 +190,4 @@ char* SHA512_Data();
#endif /* NOPROTO */
-#endif /* __SHA2_H__ */
\ No newline at end of file
+#endif /* __SHA2_H__ */
--
2.15.0