Package init

This commit is contained in:
overweight 2019-09-30 11:20:35 -04:00
commit 8d962c1715
7 changed files with 216 additions and 0 deletions

View File

@ -0,0 +1,28 @@
diff -rup yajl-2.1.0.orig/reformatter/CMakeLists.txt yajl-2.1.0.new/reformatter/CMakeLists.txt
--- yajl-2.1.0.orig/reformatter/CMakeLists.txt 2014-03-19 04:58:29.000000000 +0000
+++ yajl-2.1.0.new/reformatter/CMakeLists.txt 2014-04-28 11:36:11.909478329 +0100
@@ -26,7 +26,7 @@ LINK_DIRECTORIES(${CMAKE_CURRENT_BINARY_
ADD_EXECUTABLE(json_reformat ${SRCS})
-TARGET_LINK_LIBRARIES(json_reformat yajl_s)
+TARGET_LINK_LIBRARIES(json_reformat yajl)
# In some environments, we must explicitly link libm (like qnx,
# thanks @shahbag)
Only in yajl-2.1.0.new/reformatter: CMakeLists.txt.orig
Only in yajl-2.1.0.new/src: CMakeLists.txt~
Only in yajl-2.1.0.new/test/api: run_tests.sh~
Only in yajl-2.1.0.new/test/parsing: run_tests.sh~
diff -rup yajl-2.1.0.orig/verify/CMakeLists.txt yajl-2.1.0.new/verify/CMakeLists.txt
--- yajl-2.1.0.orig/verify/CMakeLists.txt 2014-03-19 04:58:29.000000000 +0000
+++ yajl-2.1.0.new/verify/CMakeLists.txt 2014-04-28 11:36:11.909478329 +0100
@@ -26,7 +26,7 @@ LINK_DIRECTORIES(${CMAKE_CURRENT_BINARY_
ADD_EXECUTABLE(json_verify ${SRCS})
-TARGET_LINK_LIBRARIES(json_verify yajl_s)
+TARGET_LINK_LIBRARIES(json_verify yajl)
# copy in the binary
GET_TARGET_PROPERTY(binPath json_verify LOCATION)

View File

@ -0,0 +1,31 @@
From abc2d23fbc250a859dd0430a74fba2e5c3c28d5b Mon Sep 17 00:00:00 2001
From: wujing <wujing50@huawei.com>
Date: Thu, 14 Feb 2019 03:12:30 +0800
Subject: [PATCH] yajl: fix memory leak problem
reason: fix memory leak problem
diff --git a/src/yajl_tree.c b/src/yajl_tree.c
index 3d357a3..4b3cf2b 100644
--- a/src/yajl_tree.c
+++ b/src/yajl_tree.c
@@ -143,7 +143,7 @@ static yajl_val context_pop(context_t *ctx)
ctx->stack = stack->next;
v = stack->value;
-
+ free (stack->key);
free (stack);
return (v);
@@ -444,6 +444,10 @@ yajl_val yajl_tree_parse (const char *input,
snprintf(error_buffer, error_buffer_size, "%s", internal_err_str);
YA_FREE(&(handle->alloc), internal_err_str);
}
+ while(ctx.stack != NULL) {
+ yajl_val v = context_pop(&ctx);
+ yajl_tree_free(v);
+ }
yajl_free (handle);
return NULL;
}

View File

@ -0,0 +1,11 @@
diff -rup yajl-2.1.0.orig/src/yajl.pc.cmake yajl-2.1.0.new/src/yajl.pc.cmake
--- yajl-2.1.0.orig/src/yajl.pc.cmake 2014-03-19 04:58:29.000000000 +0000
+++ yajl-2.1.0.new/src/yajl.pc.cmake 2014-04-28 11:12:23.505791003 +0100
@@ -1,6 +1,6 @@
prefix=${CMAKE_INSTALL_PREFIX}
libdir=${dollar}{prefix}/lib${LIB_SUFFIX}
-includedir=${dollar}{prefix}/include/yajl
+includedir=${dollar}{prefix}/include
Name: Yet Another JSON Library
Description: A Portable JSON parsing and serialization library in ANSI C

View File

@ -0,0 +1,27 @@
diff -rup yajl-2.1.0.orig/src/CMakeLists.txt yajl-2.1.0.new/src/CMakeLists.txt
--- yajl-2.1.0.orig/src/CMakeLists.txt 2014-03-19 04:58:29.000000000 +0000
+++ yajl-2.1.0.new/src/CMakeLists.txt 2014-04-28 11:19:28.431492533 +0100
@@ -30,7 +30,7 @@ ADD_DEFINITIONS(-DYAJL_BUILD)
# set up some paths
SET (libDir ${CMAKE_CURRENT_BINARY_DIR}/../${YAJL_DIST_NAME}/lib)
SET (incDir ${CMAKE_CURRENT_BINARY_DIR}/../${YAJL_DIST_NAME}/include/yajl)
-SET (shareDir ${CMAKE_CURRENT_BINARY_DIR}/../${YAJL_DIST_NAME}/share/pkgconfig)
+SET (pkgconfigDir ${CMAKE_CURRENT_BINARY_DIR}/../${YAJL_DIST_NAME}/lib/pkgconfig)
# set the output path for libraries
SET(LIBRARY_OUTPUT_PATH ${libDir})
@@ -61,7 +61,7 @@ FILE(MAKE_DIRECTORY ${incDir})
# generate build-time source
SET(dollar $)
CONFIGURE_FILE(api/yajl_version.h.cmake ${incDir}/yajl_version.h)
-CONFIGURE_FILE(yajl.pc.cmake ${shareDir}/yajl.pc)
+CONFIGURE_FILE(yajl.pc.cmake ${pkgconfigDir}/yajl.pc)
# copy public headers to output directory
FOREACH (header ${PUB_HDRS})
@@ -84,4 +84,4 @@ INSTALL(TARGETS yajl
INSTALL(TARGETS yajl_s ARCHIVE DESTINATION lib${LIB_SUFFIX})
INSTALL(FILES ${PUB_HDRS} DESTINATION include/yajl)
INSTALL(FILES ${incDir}/yajl_version.h DESTINATION include/yajl)
-INSTALL(FILES ${shareDir}/yajl.pc DESTINATION share/pkgconfig)
+INSTALL(FILES ${pkgconfigDir}/yajl.pc DESTINATION lib${LIB_SUFFIX}/pkgconfig)

View File

@ -0,0 +1,30 @@
diff -rup yajl-2.1.0.orig/test/api/run_tests.sh yajl-2.1.0.new/test/api/run_tests.sh
--- yajl-2.1.0.orig/test/api/run_tests.sh 2014-03-19 04:58:29.000000000 +0000
+++ yajl-2.1.0.new/test/api/run_tests.sh 2014-04-28 11:27:26.006405320 +0100
@@ -5,7 +5,7 @@ echo Running api tests:
tests=0
passed=0
-for file in `ls`; do
+for file in `ls ../../build/test/api`; do
[ ! -x $file -o -d $file ] && continue
tests=`expr 1 + $tests`
printf " test(%s): " $file
diff -rup yajl-2.1.0.orig/test/parsing/run_tests.sh yajl-2.1.0.new/test/parsing/run_tests.sh
--- yajl-2.1.0.orig/test/parsing/run_tests.sh 2014-03-19 04:58:29.000000000 +0000
+++ yajl-2.1.0.new/test/parsing/run_tests.sh 2014-04-28 11:25:51.239025722 +0100
@@ -16,11 +16,11 @@ fi
# find test binary on both platforms. allow the caller to force a
# particular test binary (useful for non-cmake build systems).
if [ -z "$testBin" ]; then
- testBin="../build/test/parsing/Release/yajl_test.exe"
+ testBin="../../build/test/parsing/Release/yajl_test.exe"
if [ ! -x $testBin ] ; then
- testBin="../build/test/parsing/Debug/yajl_test.exe"
+ testBin="../../build/test/parsing/Debug/yajl_test.exe"
if [ ! -x $testBin ] ; then
- testBin="../build/test/parsing/yajl_test"
+ testBin="../../build/test/parsing/yajl_test"
if [ ! -x $testBin ] ; then
${ECHO} "cannot execute test binary: '$testBin'"
exit 1;

BIN
yajl-2.1.0.tar.gz Normal file

Binary file not shown.

89
yajl.spec Normal file
View File

@ -0,0 +1,89 @@
Name: yajl
Version: 2.1.0
Release: 12
Summary: Yet Another JSON Library
License: ISC
URL: http://lloyd.github.com/yajl/
Source0: %{name}-%{version}.tar.gz
Patch1: yajl-2.1.0-pkgconfig-location.patch
Patch2: yajl-2.1.0-pkgconfig-includedir.patch
Patch3: yajl-2.1.0-test-location.patch
Patch4: yajl-2.1.0-dynlink-binaries.patch
Patch5: yajl-2.1.0-fix-memory-leak.patch
BuildRequires: cmake
%description
yajl is a small event-driven JSON parser written in ANSI C, and a small
validating JSON generator.
%package devel
Summary: Development files for %{name}
Requires: %{name} = %{version}-%{release}
%description devel
This package provides the libraries and includes
necessary for developing against the yajl library.
%prep
%autosetup -n %{name}-%{version} -p1
%build
mkdir build
cd build
%cmake ..
%make_build VERBOSE=1
%install
rm -rf $RPM_BUILD_ROOT
cd build
%make_install
%check
cd test/parsing
./run_tests.sh
cd ../api
./run_tests.sh
%files
%defattr(-,root,root)
%doc COPYING README ChangeLog TODO
%{_bindir}/json_reformat
%{_bindir}/json_verify
%{_libdir}/libyajl.so.*
%{_libdir}/libyajl.so
%files devel
%dir %{_includedir}/yajl
%{_includedir}/yajl/yajl_common.h
%{_includedir}/yajl/yajl_gen.h
%{_includedir}/yajl/yajl_parse.h
%{_includedir}/yajl/yajl_tree.h
%{_includedir}/yajl/yajl_version.h
%{_libdir}/pkgconfig/yajl.pc
%{_libdir}/libyajl_s.a
%changelog
* Sat Aug 31 2019 dongjian<dongjian13@huawei.com> - 2.1.0-12
- Type:bugfix
- ID:NA
- SUG:NA
- DESC: modify summary and some structures
* Tue Aug 20 2019 fangyufa<fangyufa1@huawei.com> - 2.1.0-11.h3
- Type:bugfix
- ID:NA
- SUG:NA
- DESC: modify name of patch
* Fri Aug 09 2019 fangyufa<fangyufa1@huawei.com> - 2.1.0-11.h2
- Type:bugfix
- ID:NA
- SUG:NA
- DESC: add head info of patch
* Thu Aug 01 2019 shenyangyang <shenyangyang4@huawei.com> - 2.1.0-11.h1
- Package Initialization