diff --git a/.gitignore b/.gitignore index e466c112..59338586 100644 --- a/.gitignore +++ b/.gitignore @@ -137,3 +137,6 @@ mac/cmake_install.cmake mac/CMakeFiles/ mac/CMakeCache.txt *.py.bak + +# Bazel +bazel* diff --git a/WORKSPACE b/WORKSPACE new file mode 100644 index 00000000..e69de29b diff --git a/src/BUILD b/src/BUILD new file mode 100644 index 00000000..772dd376 --- /dev/null +++ b/src/BUILD @@ -0,0 +1,16 @@ +cc_binary( + name = "ccextractor", + srcs = ["ccextractor.c", + "ccextractor.h"], + deps = [ + "//src/lib_ccx:lib_ccx", + "//src/thirdparty/protobuf-c:protobuf-c", + "//src/thirdparty/gpacmp4:gpacmp4", + "//src/thirdparty/zlib:zlib", + "//src/thirdparty/freetype:freetype" + ], + copts = [ "-Isrc/thirdparty/protobuf-c", "-Isrc/thirdparty/libpng", "-Isrc" ] +) + +exports_files (["ccextractor.h"], ["//src/lib_ccx:__pkg__"]) + diff --git a/src/lib_ccx/BUILD b/src/lib_ccx/BUILD new file mode 100644 index 00000000..32ea64f8 --- /dev/null +++ b/src/lib_ccx/BUILD @@ -0,0 +1,30 @@ +cc_library( + name = "lib_ccx", + # zvbi has been modified a lot (it has a decoder context) so we can't + # really treat as a 3rd party library + srcs = glob (["*.c", "zvbi/*.c"]), + hdrs = glob (["*.h", "zvbi/*.h", "*.xbm"]) + [ "//src:ccextractor.h" ], + visibility = ["//visibility:public"], + deps = [ + "//src/thirdparty/protobuf-c:protobuf-c", + "//src/thirdparty/libpng:libpng", + "//src/thirdparty/freetype:freetype", + "//src/thirdparty/gpacmp4:gpacmp4", + "//src/thirdparty/lib_hash:lib_hash", + "//src/thirdparty/utf8proc:utf8proc", + ], + includes = [ "thirdparty/protobuf-c", "thirdparty/libpng", "thirdparty/gpacmp4" , "." , + "thirdparty/freetype/include" ], + copts = [ "-Isrc/thirdparty/protobuf-c", + "-Isrc/thirdparty/libpng", + "-Isrc/", + "-Isrc/thirdparty/gpacmp4", + "-Isrc/thirdparty/freetype", + "-Isrc/thirdparty/lib_hash", + "-Isrc/thirdparty/freetype/include", + "-Isrc/thirdparty/" + + ] +) + + diff --git a/src/lib_ccx/ccx_decoders_vbi.h b/src/lib_ccx/ccx_decoders_vbi.h index 8d9e009b..08ca2efb 100644 --- a/src/lib_ccx/ccx_decoders_vbi.h +++ b/src/lib_ccx/ccx_decoders_vbi.h @@ -1,7 +1,7 @@ #ifndef CCX_DECODER_VBI #define CCX_DECODER_VBI -#include +#include "zvbi/zvbi_decoder.h" #define VBI_DEBUG #include "ccx_decoders_structs.h" diff --git a/src/lib_ccx/ccx_encoders_common.c b/src/lib_ccx/ccx_encoders_common.c index 1f27d4c9..26f02787 100644 --- a/src/lib_ccx/ccx_encoders_common.c +++ b/src/lib_ccx/ccx_encoders_common.c @@ -7,7 +7,7 @@ #include "ccx_decoders_708_output.h" #include "ccx_encoders_xds.h" #include "ccx_encoders_helpers.h" -#include "../ccextractor.h" +#include "ccextractor.h" #ifdef ENABLE_SHARING #include "ccx_share.h" #endif //ENABLE_SHARING diff --git a/src/lib_ccx/output.c b/src/lib_ccx/output.c index dd11753e..ab783f3c 100644 --- a/src/lib_ccx/output.c +++ b/src/lib_ccx/output.c @@ -1,5 +1,5 @@ #include "lib_ccx.h" -#include "../ccextractor.h" +#include "ccextractor.h" #include "ccx_common_option.h" #ifdef _WIN32 #include diff --git a/src/lib_ccx/zvbi/bcd.h b/src/lib_ccx/zvbi/bcd.h index dd302a90..70107ee1 100644 --- a/src/lib_ccx/zvbi/bcd.h +++ b/src/lib_ccx/zvbi/bcd.h @@ -24,7 +24,7 @@ #ifndef BCD_H #define BCD_H -#include "ccx_common_platform.h" +#include "../ccx_common_platform.h" /** * @addtogroup BCD BCD arithmetic for Teletext page numbers * @ingroup HiDec diff --git a/src/lib_ccx/zvbi/bit_slicer.c b/src/lib_ccx/zvbi/bit_slicer.c index 33b6c03d..96a4fe99 100644 --- a/src/lib_ccx/zvbi/bit_slicer.c +++ b/src/lib_ccx/zvbi/bit_slicer.c @@ -23,7 +23,7 @@ #include "misc.h" #include "bit_slicer.h" -#include "ccx_common_common.h" +#include "../ccx_common_common.h" #define VBI_PIXFMT_Y8 VBI_PIXFMT_YUV420 #define VBI_PIXFMT_RGB24_LE VBI_PIXFMT_RGB24 diff --git a/src/lib_ccx/zvbi/decoder.c b/src/lib_ccx/zvbi/decoder.c index 7a3ebfed..01e06b28 100644 --- a/src/lib_ccx/zvbi/decoder.c +++ b/src/lib_ccx/zvbi/decoder.c @@ -30,7 +30,7 @@ #include "misc.h" #include "zvbi_decoder.h" #include "raw_decoder.h" -#include "ccx_common_common.h" +#include "../ccx_common_common.h" /** * @addtogroup Rawdec Raw VBI decoder diff --git a/src/lib_ccx/zvbi/misc.h b/src/lib_ccx/zvbi/misc.h index a459a2c4..1b6199bb 100644 --- a/src/lib_ccx/zvbi/misc.h +++ b/src/lib_ccx/zvbi/misc.h @@ -37,9 +37,9 @@ #include #include "macros.h" -#include "ccx_common_platform.h" -#include "ccx_common_constants.h" -#include "ccx_common_structs.h" +#include "../ccx_common_platform.h" +#include "../ccx_common_constants.h" +#include "../ccx_common_structs.h" #define N_ELEMENTS(array) (sizeof (array) / sizeof (*(array))) diff --git a/src/lib_ccx/zvbi/raw_decoder.c b/src/lib_ccx/zvbi/raw_decoder.c index 152d16f1..4161c1cd 100644 --- a/src/lib_ccx/zvbi/raw_decoder.c +++ b/src/lib_ccx/zvbi/raw_decoder.c @@ -28,7 +28,7 @@ #include "misc.h" #include "raw_decoder.h" -#include "ccx_common_common.h" +#include "../ccx_common_common.h" #ifndef RAW_DECODER_PATTERN_DUMP # define RAW_DECODER_PATTERN_DUMP 0 #endif diff --git a/src/lib_ccx/zvbi/sampling_par.c b/src/lib_ccx/zvbi/sampling_par.c index 24c1a012..8fe46e77 100644 --- a/src/lib_ccx/zvbi/sampling_par.c +++ b/src/lib_ccx/zvbi/sampling_par.c @@ -27,7 +27,7 @@ #include "raw_decoder.h" #include "sampling_par.h" #include "sliced.h" -#include "ccx_common_common.h" +#include "../ccx_common_common.h" #define vbi_pixfmt_bytes_per_pixel VBI_PIXFMT_BPP #define sp_sample_format sampling_format diff --git a/src/thirdparty/freetype/BUILD b/src/thirdparty/freetype/BUILD new file mode 100644 index 00000000..c04aff03 --- /dev/null +++ b/src/thirdparty/freetype/BUILD @@ -0,0 +1,59 @@ +cc_library( + name = "freetype", + srcs = [ + "autofit/autofit.c", + "base/ftbase.c", + "base/ftbbox.c", + "base/ftbdf.c", + "base/ftbitmap.c", + "base/ftcid.c", + "base/ftfntfmt.c", + "base/ftfstype.c", + "base/ftgasp.c", + "base/ftglyph.c", + "base/ftgxval.c", + "base/ftinit.c", + "base/ftlcdfil.c", + "base/ftmm.c", + "base/ftotval.c", + "base/ftpatent.c", + "base/ftpfr.c", + "base/ftstroke.c", + "base/ftsynth.c", + "base/ftsystem.c", + "base/fttype1.c", + "base/ftwinfnt.c", + "bdf/bdf.c", + "bzip2/ftbzip2.c", + "cache/ftcache.c", + "cff/cff.c", + "cid/type1cid.c", + "gzip/ftgzip.c", + "lzw/ftlzw.c", + "pcf/pcf.c", + "pfr/pfr.c", + "psaux/psaux.c", + "pshinter/pshinter.c", + "psnames/psnames.c", + "raster/raster.c", + "sfnt/sfnt.c", + "smooth/smooth.c", + "truetype/truetype.c", + "type1/type1.c", + "type42/type42.c", + "winfonts/winfnt.c" + ], + hdrs = glob([ + "**/*.h", + ]), + textual_hdrs = glob(["**/*.c"]), + visibility = ["//visibility:public"], + copts = [ + "-DFT2_BUILD_LIBRARY", + "-Isrc/thirdparty/freetype/include", + "-Isrc/thirdparty/freetype/include/freetype/internal", + "-Isrc/thirdparty/freetype/include/freetype/internal/services", + "-Isrc/thirdparty/freetype/include/freetype/config" + ] +) + diff --git a/src/thirdparty/gpacmp4/BUILD b/src/thirdparty/gpacmp4/BUILD new file mode 100644 index 00000000..141b1f74 --- /dev/null +++ b/src/thirdparty/gpacmp4/BUILD @@ -0,0 +1,8 @@ +cc_library( + name = "gpacmp4", + srcs = glob(["*.c"]), + hdrs = glob(["*.h", "gpac/*.h", "gpac/internal/*.h" ]), + copts = [ "-I src/thirdparty/gpacmp4/" , "-DGPAC_CONFIG_LINUX -D_FILE_OFFSET_BITS=64 -DVERSION_FILE_PRESENT -DENABLE_OCR -DFT2_BUILD_LIBRARY -DGPAC_DISABLE_VTT -DGPAC_DISABLE_OD_DUMP" ], + visibility = ["//visibility:public"], +) + diff --git a/src/thirdparty/lib_hash/BUILD b/src/thirdparty/lib_hash/BUILD new file mode 100644 index 00000000..b6023187 --- /dev/null +++ b/src/thirdparty/lib_hash/BUILD @@ -0,0 +1,7 @@ +cc_library( + name = "lib_hash", + srcs = glob(["*.c"]), + hdrs = glob(["*.h"]), + visibility = ["//visibility:public"], +) + diff --git a/src/thirdparty/libpng/BUILD b/src/thirdparty/libpng/BUILD new file mode 100644 index 00000000..189eab68 --- /dev/null +++ b/src/thirdparty/libpng/BUILD @@ -0,0 +1,7 @@ +cc_library( + name = "libpng", + srcs = glob(["*.c"]), + hdrs = glob(["*.h"]), + visibility = ["//visibility:public"], +) + diff --git a/src/thirdparty/protobuf-c/BUILD b/src/thirdparty/protobuf-c/BUILD new file mode 100644 index 00000000..ce939593 --- /dev/null +++ b/src/thirdparty/protobuf-c/BUILD @@ -0,0 +1,16 @@ +cc_library( + name = "protobuf-c", + srcs = ["protobuf-c.c"], + hdrs = ["protobuf-c.h"], + visibility = ["//visibility:public"], +) + +cc_test( + name = "protobuf-c_test", + srcs = ["protobuf-c_test.cc"], + deps = [":protobuf-c"] +) + + + + diff --git a/src/thirdparty/utf8proc/BUILD b/src/thirdparty/utf8proc/BUILD new file mode 100644 index 00000000..075033b9 --- /dev/null +++ b/src/thirdparty/utf8proc/BUILD @@ -0,0 +1,7 @@ +cc_library( + name = "utf8proc", + srcs = glob(["utf8proc.c"]), + hdrs = glob(["*.h", "utf8proc_data.c"]), + visibility = ["//visibility:public"], +) + diff --git a/src/thirdparty/win_iconv/BUILD b/src/thirdparty/win_iconv/BUILD new file mode 100644 index 00000000..61041939 --- /dev/null +++ b/src/thirdparty/win_iconv/BUILD @@ -0,0 +1,7 @@ +cc_library( + name = "win_iconv", + srcs = glob(["win_iconv.c"]), + hdrs = glob(["iconv.h"]), + visibility = ["//visibility:public"], +) + diff --git a/src/thirdparty/zlib/BUILD b/src/thirdparty/zlib/BUILD new file mode 100644 index 00000000..5086ce08 --- /dev/null +++ b/src/thirdparty/zlib/BUILD @@ -0,0 +1,7 @@ +cc_library( + name = "zlib", + srcs = glob(["*.c"]), + hdrs = glob(["*.h"]), + visibility = ["//visibility:public"], +) +