ccextractor/mac/build.command

61 lines
3.3 KiB
Plaintext
Raw Normal View History

#!/bin/bash
cd `dirname $0`
BLD_FLAGS="-std=gnu99 -Wno-write-strings -Wno-pointer-sign -DGPAC_CONFIG_DARWIN -D_FILE_OFFSET_BITS=64 -DVERSION_FILE_PRESENT -Dfopen64=fopen -Dopen64=open -Dlseek64=lseek -DFT2_BUILD_LIBRARY -DGPAC_DISABLE_VTT -DGPAC_DISABLE_OD_DUMP -DGPAC_DISABLE_REMOTERY -DNO_GZIP -DGPAC_HAVE_CONFIG_H -DDISABLE_RUST"
[[ $1 = "OCR" ]] && BLD_FLAGS="$BLD_FLAGS -DENABLE_OCR"
BLD_INCLUDE="-I../src/ -I../src/lib_ccx -I../src/thirdparty/gpacmp4 -I../src/lib_hash -I../src/thirdparty/libpng -I../src/thirdparty -I../src/thirdparty/protobuf-c -I../src/thirdparty/zlib -I../src/thirdparty/freetype/include"
[[ $1 = "OCR" ]] && BLD_INCLUDE="$BLD_INCLUDE `pkg-config --cflags --silence-errors tesseract`"
SRC_CCX="$(find ../src/lib_ccx -name '*.c')"
SRC_GPAC="$(find ../src/thirdparty/gpacmp4 -name '*.c')"
SRC_LIB_HASH="$(find ../src/thirdparty/lib_hash -name '*.c')"
SRC_LIBPNG="$(find ../src/thirdparty/libpng -name '*.c')"
SRC_PROTOBUF="$(find ../src/thirdparty/protobuf-c -name '*.c')"
SRC_UTF8="../src/thirdparty/utf8proc/utf8proc.c"
SRC_ZLIB="$(find ../src/thirdparty/zlib -name '*.c')"
SRC_FREETYPE="../src/thirdparty/freetype/autofit/autofit.c \
../src/thirdparty/freetype/base/ftbase.c \
../src/thirdparty/freetype/base/ftbbox.c \
../src/thirdparty/freetype/base/ftbdf.c \
../src/thirdparty/freetype/base/ftbitmap.c \
../src/thirdparty/freetype/base/ftcid.c \
../src/thirdparty/freetype/base/ftfntfmt.c \
../src/thirdparty/freetype/base/ftfstype.c \
../src/thirdparty/freetype/base/ftgasp.c \
../src/thirdparty/freetype/base/ftglyph.c \
../src/thirdparty/freetype/base/ftgxval.c \
../src/thirdparty/freetype/base/ftinit.c \
../src/thirdparty/freetype/base/ftlcdfil.c \
../src/thirdparty/freetype/base/ftmm.c \
../src/thirdparty/freetype/base/ftotval.c \
../src/thirdparty/freetype/base/ftpatent.c \
../src/thirdparty/freetype/base/ftpfr.c \
../src/thirdparty/freetype/base/ftstroke.c \
../src/thirdparty/freetype/base/ftsynth.c \
../src/thirdparty/freetype/base/ftsystem.c \
../src/thirdparty/freetype/base/fttype1.c \
../src/thirdparty/freetype/base/ftwinfnt.c \
../src/thirdparty/freetype/bdf/bdf.c \
../src/thirdparty/freetype/bzip2/ftbzip2.c \
../src/thirdparty/freetype/cache/ftcache.c \
../src/thirdparty/freetype/cff/cff.c \
../src/thirdparty/freetype/cid/type1cid.c \
../src/thirdparty/freetype/gzip/ftgzip.c \
../src/thirdparty/freetype/lzw/ftlzw.c \
../src/thirdparty/freetype/pcf/pcf.c \
../src/thirdparty/freetype/pfr/pfr.c \
../src/thirdparty/freetype/psaux/psaux.c \
../src/thirdparty/freetype/pshinter/pshinter.c \
../src/thirdparty/freetype/psnames/psnames.c \
../src/thirdparty/freetype/raster/raster.c \
../src/thirdparty/freetype/sfnt/sfnt.c \
../src/thirdparty/freetype/smooth/smooth.c \
../src/thirdparty/freetype/truetype/truetype.c \
../src/thirdparty/freetype/type1/type1.c \
../src/thirdparty/freetype/type42/type42.c \
../src/thirdparty/freetype/winfonts/winfnt.c"
BLD_SOURCES="../src/ccextractor.c $SRC_API $SRC_CCX $SRC_GPAC $SRC_LIB_HASH $SRC_LIBPNG $SRC_PROTOBUF $SRC_UTF8 $SRC_ZLIB $SRC_ZVBI $SRC_FREETYPE"
[IMPROVEMENT] Update GPAC to version 1.0.1 (#1328) * Add update_gpac.py Add a Python script that partially automates updating GPAC to a newer version. * Update GPAC to version 1.0.1 Update the vendored version of GPAC to version 1.0.1. * Add necessary GPAC header files Add some GPAC header files that GPAC needs to compile. * Define _GF_CONFIG_H_ to fix Linux build failing gpac/configuration.h has a series of default configuration options for various platforms, but it doesn't have a case for Linux and it results in a compilation error if it encounters an unknown platform. The settings in configuration.h don't appear to try to set any defaults for Linux anyway, so we can disable all use of those configuration.h settings by defining _GF_CONFIG_H_. * Add some more necessary GPAC header files Add a few more header files necessary to get GPAC to compile. * Fix renamed and removed media types Some mp4 media types ("clcp", "c608") were renamed by GPAC. "c708" appears to have been removed, so we can just add the definition of that to the top of mp4.c. * Remove Remotery from updated GPAC Remotery appears to be some code for profiling GPAC which we aren't using, and including Remotery.c and Remotery.h ends up pulling in a lot of files, so it's easier to just remove the include of Remotery.h and the single use of it in os_divers.c * Remove unused box definitions Remove box definitions that we don't use from box_funcs.c in order to avoid adding too many files from GPAC. * Replace alloc function declarations with defines Replace the GPAC wrappers around the malloc-style functions (gf_malloc, gf_free, etc.) with defines that use the standard C versions of these functions so that we can avoid including GPAC's alloc.c * Remove WebVTT handling code in gf_isom_dump_srt_track Remove the code that handles WebVTT in gf_isom_dump_srt_track to avoid needing to pull in a lot of other files from GPAC. gf_isom_dump_srt_track doesn't appear to be used by ccextractor directly or indirectly (it's only called in gf_isom_text_dump which doesn't appear to be called anywhere else) so it should be fine removing it. * Disable use of Remotery and gzip on Linux Use GPAC_DISABLE_REMOTERY and NO_GZIP to disable Remotery because we aren't interested in profiling (see 5c0c9cf71e17b95dc4fd8015d81040fd03858ce9 for more info) and gzip compression through gzio.c respectively. * Fix compilation errors in GPAC on linux GPAC on linux after the update requires some threading functions and dynamic loading functions in pthread and dl respectively. * Add necessary files for GPAC to compile Add several C and header files that GPAC needs to compile * Disable Remotery and Gzip in all build systems Disable Remotery and gzip (using the same method as f49dc371b5f8c74de7b35615042c9767823a6c05) for: - The linux build script (linux/build) - The mac build script (mac/build.command) - The mac makefile - cmake - bazel - Visual Studio * Add extra GPAC files to several build systems Add the names of several GPAC files that were added in the update to the linux and mac Makefiles and to the Windows Visual Studio project. Adding these filenames isn't necessary for CMake, Bazel, or the linux or mac build scripts because all of them compile all C files recursively in the src/thirdparty/gpacmp4 directory instead of having an explicit list of files to compile. * Change NO_GZIP to GPAC_DISABLE_ZLIB in VS project Instead of defining NO_GZIP to disable gzip support, define GPAC_DISABLE_ZLIB, which does the same thing but also prevents the compiler from trying to zlib. * Avoid using GPAC's configuration.h completely GPAC's configuration.h has a few problems with the defaults that it sets: - It defines GPAC_MEMORY_TRACKING on Windows, which switches to an alternate implementation of malloc, meaning that we would have to pull in alloc.c - It causes compilation errors on Linux (see 9164c0897951f7795e85bc95b1a1eaaf95a16482) This disables using configuration.h by: - Defining GPAC_HAVE_CONFIG_H to make GPAC use a separate config.h file instead of the default configuration.h file - Making an essentially empty config.h file to make attempts to include it not fail This commit also removes configuration.h from the repo to make sure we don't accidentally include it, and removes the _GF_CONFIG_H_ hack from the previously mentioned commit because we don't need it anymore (it's sole purpose was avoiding using configuration.h). * Link pthread and dl on Mac and Linux Add -lpthread and -ldl to link pthread and dl respectively on Mac and Linux. Needed because the update to GPAC 1.0.1 introduced os_thread.c (which uses pthread) and os_module.c (which uses dlsym and related functions). * Remove unused Remotery.h header file 5c0c9cf71e17b95dc4fd8015d81040fd03858ce9 removed the only use of Remotery.h in the GPAC files that we pulled in, so there's no need to keep it around. * Add GPAC update to changelog * Fix cmake build error Building with CMake currently fails because it can't find functions from dl (dlopen, dlsym, etc.) * Fix bazel build error Bazel currently doesn't find the header files in gpac/modules/ when building gpac, most likely because it isn't searching all directories in gpac/ recursively for header files * Define GPAC_HAVE_CONFIG_H in lib_ccx BUILD file lib_ccx indirectly includes gpac/tools.h, which tries to include gpac/configuration.h, which was removed in b46c4e8a2da7709eb0a6cf23b4ecffa9e98bed67. This just copies the solution from that commit to the bazel BUILD file (defining GPAC_HAVE_CONFIG_H so GPAC uses gpac/config.h instead). * Link to dl and pthread in bazel GPAC BUILD file The updated GPAC version requires functions from dl and pthread, which weren't linked to previously when building with bazel.
2021-04-30 11:59:13 +00:00
BLD_LINKER="-lm -liconv -lpthread -ldl"
[[ $1 = "OCR" ]] && BLD_LINKER="$BLD_LINKER `pkg-config --libs --silence-errors tesseract` `pkg-config --libs --silence-errors lept`"
2015-05-04 11:39:06 +00:00
2016-05-22 07:44:55 +00:00
./pre-build.sh
gcc $BLD_FLAGS $BLD_INCLUDE -o ccextractor $BLD_SOURCES $BLD_LINKER