From: Parichay Kapoor Date: Wed, 4 Sep 2019 05:59:53 +0000 (+0900) Subject: [build] Use patch file for modification in build X-Git-Tag: accepted/tizen/unified/20190925.220436~13 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=76e42f6a998fd52ab1794fb88c4391749eb19b0e;p=platform%2Fupstream%2Fnnstreamer.git [build] Use patch file for modification in build Use patch file to modify the nnstreamer.h when building for non-tizen systems Signed-off-by: Parichay Kapoor --- diff --git a/api/android/build-android-lib.sh b/api/android/build-android-lib.sh index 17d3b2c..1d5be8f 100644 --- a/api/android/build-android-lib.sh +++ b/api/android/build-android-lib.sh @@ -72,7 +72,9 @@ echo "Start to build NNStreamer library for Android." # Modify header for Android cd $NNSTREAMER_ROOT/api/capi -./modify_nnstreamer_h_for_nontizen.sh +if ! patch -R --dry-run -sfp1 -i $NNSTREAMER_ROOT/packaging/non_tizen_build.patch; then + patch -sfp1 -i $NNSTREAMER_ROOT/packaging/non_tizen_build.patch +fi cd $NNSTREAMER_ROOT # Make directory to build NNStreamer library @@ -136,4 +138,3 @@ popd # Remove build directory rm -rf build_android_lib - diff --git a/api/capi/meson.build b/api/capi/meson.build index 076a657..31b688d 100644 --- a/api/capi/meson.build +++ b/api/capi/meson.build @@ -48,9 +48,12 @@ if (get_option('enable-tizen')) dependency('dlog') ] else - r = run_command('./modify_nnstreamer_h_for_nontizen.sh') + r = run_command('patch', '-R', '--dry-run', '-sfp1', '-i', patch_file) if (r.returncode() != 0) - message('Non-Tizen mode support failed') + r = run_command('patch', '-p1', '-i', patch_file) + if (r.returncode() != 0) + message('Non-Tizen mode support failed') + endif endif message('CAPI is in non-Tizen mode') endif diff --git a/meson.build b/meson.build index 80ed5bf..14b4606 100644 --- a/meson.build +++ b/meson.build @@ -228,6 +228,9 @@ if get_option('enable-nnfw') add_project_arguments('-DENABLE_NNFW=1', language: ['c', 'cpp']) endif +# Patch for non-tizen build +patch_file = join_paths(meson.current_source_dir(), 'packaging', 'non_tizen_build.patch') + # Build nnstreamer (common, plugins) subdir('gst') diff --git a/packaging/non_tizen_build.patch b/packaging/non_tizen_build.patch new file mode 100644 index 0000000..fe39d38 --- /dev/null +++ b/packaging/non_tizen_build.patch @@ -0,0 +1,21 @@ +diff --git a/include/nnstreamer.h b/include/nnstreamer.h +index a18a066..ab1808c 100644 +--- a/include/nnstreamer.h ++++ b/include/nnstreamer.h +@@ -28,7 +28,15 @@ + #include + + /* Apply modify_nnstreamer_h_for_nontizen.sh if you want to use in non-Tizen Linux machines */ +-#include ++#include ++#define TIZEN_ERROR_NONE (0) ++#define TIZEN_ERROR_INVALID_PARAMETER (-EINVAL) ++#define TIZEN_ERROR_STREAMS_PIPE (-ESTRPIPE) ++#define TIZEN_ERROR_TRY_AGAIN (-EAGAIN) ++#define TIZEN_ERROR_UNKNOWN (-1073741824LL) ++#define TIZEN_ERROR_TIMED_OUT (TIZEN_ERROR_UNKNOWN + 1) ++#define TIZEN_ERROR_NOT_SUPPORTED (TIZEN_ERROR_UNKNOWN + 2) ++#define TIZEN_ERROR_PERMISSION_DENIED (-EACCES) + + #ifdef __cplusplus + extern "C" {