From a963ac6321e2b3f18d15081dab1da5da510b0030 Mon Sep 17 00:00:00 2001 From: s00567839 Date: Mon, 24 Aug 2020 10:28:22 +0800 Subject: [PATCH] TicketNo:AR000E1RKT Description:libjpeg gn Team:OTHERS Feature or Bugfix:Bugfix Binary Source:No PrivateCode(Yes/No):No Change-Id: I2dfa6291ddcf6bd29ca9e40ec4bcad8ac51391d4 Reviewed-on: http://mgit-tm.rnd.huawei.com/10401035 Tested-by: public jenkins Reviewed-by: lizan 00277932 Reviewed-by: zhangguyuan 00314551 Reviewed-by: wangjing 00270068 --- BUILD.gn | 76 +++++++++++++++++--- build.sh | 16 ----- huawei_libjpeg_patch1.patch | 136 ------------------------------------ jconfig.h | 60 ++++++++++++++++ 4 files changed, 128 insertions(+), 160 deletions(-) delete mode 100755 build.sh delete mode 100755 huawei_libjpeg_patch1.patch create mode 100644 jconfig.h diff --git a/BUILD.gn b/BUILD.gn index 6f4c609..263cb4c 100755 --- a/BUILD.gn +++ b/BUILD.gn @@ -2,15 +2,75 @@ import("//build/lite/config/component/lite_component.gni") -build_ext_component("libjpeg") { - outdir = rebase_path("$root_out_dir") - command = "./build.sh ${outdir}" - exec_path = rebase_path(".", root_build_dir) +config("libjpeg_config") { + include_dirs = [ + "//third_party/libjpeg", + ] } -lite_component("jpeg") { - deps = [ - ":libjpeg" + libjpeg_source = [ + "//third_party/libjpeg/cdjpeg.c", + "//third_party/libjpeg/jaricom.c", + "//third_party/libjpeg/jcapimin.c", + "//third_party/libjpeg/jcapistd.c", + "//third_party/libjpeg/jcarith.c", + "//third_party/libjpeg/jccoefct.c", + "//third_party/libjpeg/jccolor.c", + "//third_party/libjpeg/jcdctmgr.c", + "//third_party/libjpeg/jchuff.c", + "//third_party/libjpeg/jcinit.c", + "//third_party/libjpeg/jcmainct.c", + "//third_party/libjpeg/jcmarker.c", + "//third_party/libjpeg/jcmaster.c", + "//third_party/libjpeg/jcomapi.c", + "//third_party/libjpeg/jcparam.c", + "//third_party/libjpeg/jcprepct.c", + "//third_party/libjpeg/jcsample.c", + "//third_party/libjpeg/jctrans.c", + "//third_party/libjpeg/jdapimin.c", + "//third_party/libjpeg/jdapistd.c", + "//third_party/libjpeg/jdarith.c", + "//third_party/libjpeg/jdatadst.c", + "//third_party/libjpeg/jdatasrc.c", + "//third_party/libjpeg/jdcoefct.c", + "//third_party/libjpeg/jdcolor.c", + "//third_party/libjpeg/jddctmgr.c", + "//third_party/libjpeg/jdhuff.c", + "//third_party/libjpeg/jdinput.c", + "//third_party/libjpeg/jdmainct.c", + "//third_party/libjpeg/jdmarker.c", + "//third_party/libjpeg/jdmaster.c", + "//third_party/libjpeg/jdmerge.c", + "//third_party/libjpeg/jdpostct.c", + "//third_party/libjpeg/jdsample.c", + "//third_party/libjpeg/jdtrans.c", + "//third_party/libjpeg/jerror.c", + "//third_party/libjpeg/jfdctflt.c", + "//third_party/libjpeg/jfdctfst.c", + "//third_party/libjpeg/jfdctint.c", + "//third_party/libjpeg/jidctflt.c", + "//third_party/libjpeg/jidctfst.c", + "//third_party/libjpeg/jidctint.c", + "//third_party/libjpeg/jmemansi.c", + "//third_party/libjpeg/jmemmgr.c", + "//third_party/libjpeg/jquant1.c", + "//third_party/libjpeg/jquant2.c", + "//third_party/libjpeg/jutils.c", + "//third_party/libjpeg/rdbmp.c", + "//third_party/libjpeg/rdcolmap.c", + "//third_party/libjpeg/rdgif.c", + "//third_party/libjpeg/rdppm.c", + "//third_party/libjpeg/rdrle.c", + "//third_party/libjpeg/rdswitch.c", + "//third_party/libjpeg/rdtarga.c", + "//third_party/libjpeg/transupp.c", +] + +lite_library("libjpeg") { + target_type = "shared_library" + sources = libjpeg_source + + public_configs = [ + ":libjpeg_config", ] - features = [] } diff --git a/build.sh b/build.sh deleted file mode 100755 index 8cb6b60..0000000 --- a/build.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -# Copyright (c) Huawei Technologies Co., Ltd. 2020. All rights reserved. - -set -e -OUT_DIR=$1 -ROOT_DIR=$(dirname "$0") - -git checkout -- configure -git apply huawei_libjpeg_patch1.patch - -./configure CFLAGS='-fstack-protector-strong -Wl,-z,relro,-z,now' CC=$ROOT_DIR/../../prebuilts/gcc/linux-x86/arm/arm-linux-ohoseabi-gcc/bin/arm-linux-ohoseabi-gcc --host=arm-linux - -make clean -make -j -$ROOT_DIR/../../prebuilts/gcc/linux-x86/arm/arm-linux-ohoseabi-gcc/arm-linux-ohoseabi/bin/strip $ROOT_DIR/.libs/libjpeg.so -cp $ROOT_DIR/.libs/libjpeg.so $OUT_DIR/libjpeg.so diff --git a/huawei_libjpeg_patch1.patch b/huawei_libjpeg_patch1.patch deleted file mode 100755 index bac9ced..0000000 --- a/huawei_libjpeg_patch1.patch +++ /dev/null @@ -1,136 +0,0 @@ -diff --git a/configure b/configure -index ccd339d..5623be1 100755 ---- a/configure -+++ b/configure -@@ -10501,7 +10501,7 @@ _LT_EOF - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support -- archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' -+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $lib' - archive_expsym_cmds='' - ;; - m68k) -@@ -10517,7 +10517,7 @@ _LT_EOF - allow_undefined_flag=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME -- archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' -+ archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags -o $lib' - else - ld_shlibs=no - fi -@@ -10551,7 +10551,7 @@ _LT_EOF - ;; - - haiku*) -- archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' -+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $lib' - link_all_deplibs=yes - ;; - -@@ -10646,13 +10646,13 @@ _LT_EOF - *Sun\ F*) # Sun Fortran 8.3 - tmp_sharedflag='-G' ;; - esac -- archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' -+ archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags -o $lib' - - if test yes = "$supports_anon_versioning"; then - archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ -- $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' -+ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-version-script $wl$output_objdir/$libname.ver -o $lib' - fi - - case $cc_basename in -@@ -10682,8 +10682,8 @@ _LT_EOF - archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else -- archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' -- archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' -+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags -o $lib' -+ archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - -@@ -10701,8 +10701,8 @@ _LT_EOF - - _LT_EOF - elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then -- archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' -- archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' -+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags -o $lib' -+ archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi -@@ -10730,8 +10730,8 @@ _LT_EOF - # requires that you compile everything twice, which is a pain. - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' -- archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' -- archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' -+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $lib' -+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi -@@ -10748,8 +10748,8 @@ _LT_EOF - - *) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then -- archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' -- archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' -+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags -o $lib' -+ archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi -@@ -11048,7 +11048,7 @@ fi - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support -- archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' -+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $lib' - archive_expsym_cmds='' - ;; - m68k) -@@ -11317,7 +11317,7 @@ fi - - irix5* | irix6* | nonstopux*) - if test yes = "$GCC"; then -- archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' -+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' - # Try to use the -exported_symbol ld option, if it does not - # work, assume that -exports_file does not work either and - # implicitly export all symbols. -@@ -11345,7 +11345,7 @@ fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 - $as_echo "$lt_cv_irix_exported_symbol" >&6; } - if test yes = "$lt_cv_irix_exported_symbol"; then -- archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' -+ archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' - fi - else - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' -@@ -11440,7 +11440,7 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; } - osf3*) - if test yes = "$GCC"; then - allow_undefined_flag=' $wl-expect_unresolved $wl\*' -- archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' -+ archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' -@@ -11453,7 +11453,7 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; } - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test yes = "$GCC"; then - allow_undefined_flag=' $wl-expect_unresolved $wl\*' -- archive_cmds='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' -+ archive_cmds='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' - hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' - else - allow_undefined_flag=' -expect_unresolved \*' diff --git a/jconfig.h b/jconfig.h new file mode 100644 index 0000000..2d05a3b --- /dev/null +++ b/jconfig.h @@ -0,0 +1,60 @@ +/* jconfig.h. Generated from jconfig.cfg by configure. */ +/* jconfig.cfg --- source file edited by configure script */ +/* see jconfig.txt for explanations */ + +#define HAVE_PROTOTYPES 1 +#define HAVE_UNSIGNED_CHAR 1 +#define HAVE_UNSIGNED_SHORT 1 +/* #undef void */ +/* #undef const */ +/* #undef CHAR_IS_UNSIGNED */ +#define HAVE_STDDEF_H 1 +#define HAVE_STDLIB_H 1 +#define HAVE_LOCALE_H 1 +/* #undef NEED_BSD_STRINGS */ +/* #undef NEED_SYS_TYPES_H */ +/* #undef NEED_FAR_POINTERS */ +/* #undef NEED_SHORT_EXTERNAL_NAMES */ +/* Define this if you get warnings about undefined structures. */ +/* #undef INCOMPLETE_TYPES_BROKEN */ + +/* Define "boolean" as unsigned char, not enum, on Windows systems. */ +#ifdef _WIN32 +#ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */ +typedef unsigned char boolean; +#endif +#ifndef FALSE /* in case these macros already exist */ +#define FALSE 0 /* values of boolean */ +#endif +#ifndef TRUE +#define TRUE 1 +#endif +#define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */ +#endif + +#ifdef JPEG_INTERNALS + +/* #undef RIGHT_SHIFT_IS_UNSIGNED */ +#define INLINE __inline__ +/* These are for configuring the JPEG memory manager. */ +/* #undef DEFAULT_MAX_MEM */ +/* #undef NO_MKTEMP */ + +#endif /* JPEG_INTERNALS */ + +#ifdef JPEG_CJPEG_DJPEG + +#define BMP_SUPPORTED /* BMP image file format */ +#define GIF_SUPPORTED /* GIF image file format */ +#define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */ +/* #undef RLE_SUPPORTED */ +#define TARGA_SUPPORTED /* Targa image file format */ + +/* #undef TWO_FILE_COMMANDLINE */ +/* #undef NEED_SIGNAL_CATCHER */ +/* #undef DONT_USE_B_MODE */ + +/* Define this if you want percent-done progress reports from cjpeg/djpeg. */ +/* #undef PROGRESS_REPORT */ + +#endif /* JPEG_CJPEG_DJPEG */ -- GitLab