Skip to content

Commit dbbd973

Browse files
committed
Merge branch 'devel'
2 parents 19dfba0 + 6df603a commit dbbd973

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+9941
-7265
lines changed

CMakeLists.txt

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
cmake_minimum_required(VERSION 2.8.9)
22
project(libyang C)
33

4+
include(GNUInstallDirs)
5+
46
set(LIBYANG_DESCRIPTION "libyang is YANG data modelling language parser and toolkit written (and providing API) in C.")
57

68
# set version
79
set(LIBYANG_MAJOR_VERSION 0)
8-
set(LIBYANG_MINOR_VERSION 10)
9-
set(LIBYANG_MICRO_VERSION 239)
10+
set(LIBYANG_MINOR_VERSION 11)
11+
set(LIBYANG_MICRO_VERSION 43)
1012
set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_MICRO_VERSION})
1113
set(LIBYANG_SOVERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION})
1214
configure_file(${PROJECT_SOURCE_DIR}/src/libyang.h.in ${PROJECT_SOURCE_DIR}/src/libyang.h)
@@ -32,7 +34,7 @@ else()
3234
add_custom_target(bison
3335
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/src
3436
COMMAND bison -Wno-other -l -o parser_yang_bis.c --defines=parser_yang_bis.h yang.y
35-
COMMAND flex -L -o parser_yang_lex.c --header-file=parser_yang_lex.h yang.l
37+
COMMAND flex -8 -L -o parser_yang_lex.c --header-file=parser_yang_lex.h yang.l
3638
COMMAND ${SED_TOOL} -i 's/int yychar\;/int yychar\;\\nchar *s = NULL, *tmp_s = NULL\;\\nstruct lys_include inc\;\\nstruct lys_module *trg = NULL\;\\nstruct lys_node *tpdf_parent = NULL, *data_node = NULL\;\\nvoid *actual = NULL\;\\nstruct lys_node_uses *refine_parent = NULL\;\\nint config_inherit = 0, actual_type = 0\;\\nint64_t cnt_val\;\\nint read_string = read_all\;\\nvoid *yang_type = NULL\;/' parser_yang_bis.c
3739
)
3840
endif()
@@ -42,14 +44,6 @@ if(NOT UNIX)
4244
message(FATAL_ERROR "Only *nix like systems are supported.")
4345
endif()
4446

45-
if(NOT LIB_INSTALL_DIR)
46-
set(LIB_INSTALL_DIR lib)
47-
endif()
48-
49-
if(NOT INCLUDE_INSTALL_DIR)
50-
set(INCLUDE_INSTALL_DIR include/libyang)
51-
endif()
52-
5347
# set default build type if not specified by user
5448
if(NOT CMAKE_BUILD_TYPE)
5549
set(CMAKE_BUILD_TYPE debug)
@@ -129,21 +123,21 @@ find_package(PCRE REQUIRED)
129123
include_directories(${PCRE_INCLUDE_DIRS})
130124
target_link_libraries(yang ${PCRE_LIBRARIES})
131125

132-
install(TARGETS yang DESTINATION ${LIB_INSTALL_DIR})
133-
install(FILES ${headers} DESTINATION ${INCLUDE_INSTALL_DIR})
126+
install(TARGETS yang DESTINATION ${CMAKE_INSTALL_LIBDIR})
127+
install(FILES ${headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libyang)
134128

135129
find_package(PkgConfig)
136130
if(PKG_CONFIG_FOUND)
137131
# generate and install pkg-config file
138132
configure_file("libyang.pc.in" "libyang.pc" @ONLY)
139-
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libyang.pc" DESTINATION "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}/pkgconfig")
133+
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libyang.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
140134
# check that pkg-config includes the used path
141135
execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --variable pc_path pkg-config RESULT_VARIABLE RETURN OUTPUT_VARIABLE PC_PATH ERROR_QUIET)
142136
if(RETURN EQUAL 0)
143-
string(REGEX MATCH "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}/pkgconfig" SUBSTR "${PC_PATH}")
137+
string(REGEX MATCH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/pkgconfig" SUBSTR "${PC_PATH}")
144138
string(LENGTH "${SUBSTR}" SUBSTR_LEN)
145139
if(SUBSTR_LEN EQUAL 0)
146-
message(WARNING "pkg-config will not detect the new package after installation, adjust PKG_CONFIG_PATH using \"export PKG_CONFIG_PATH=\${PKG_CONFIG_PATH}:${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}/pkgconfig\".")
140+
message(WARNING "pkg-config will not detect the new package after installation, adjust PKG_CONFIG_PATH using \"export PKG_CONFIG_PATH=\${PKG_CONFIG_PATH}:${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/pkgconfig\".")
147141
endif()
148142
endif()
149143
endif()
@@ -167,6 +161,8 @@ add_custom_target(cclean
167161

168162
add_executable(yanglint ${lintsrc})
169163
target_link_libraries(yanglint yang)
164+
install(TARGETS yanglint DESTINATION ${CMAKE_INSTALL_BINDIR})
165+
install(FILES ${PROJECT_SOURCE_DIR}/tools/lint/yanglint.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
170166

171167
add_executable(yang2yin ${yang2yinsrc})
172168

README.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,15 @@ providing API) in C. The library is used e.g. in [libnetconf2](https://github.co
1919
([RFC 7951](https://tools.ietf.org/html/rfc7951)).
2020
* Manipulation with the instance data.
2121
* Support for default values in the instance data ([RFC 6243](https://tools.ietf.org/html/rfc6243)).
22+
* [yanglint](#yanglint) - features rich YANG tool.
2223

2324
Current implementation covers YANG 1.0 ([RFC 6020](https://tools.ietf.org/html/rfc6020))
2425
as well as YANG 1.1 ([RFC 7950](https://tools.ietf.org/html/rfc7950)).
2526

2627
## Planned Features
2728

2829
* YANG Metadata ([RFC 7952](https://tools.ietf.org/html/rfc7952)).
29-
* [yanglint](#yanglint) as a full-fledged YANG tool.
30+
* Modular mechanism for supporting YANG extensions.
3031

3132
## Requirements
3233

@@ -52,6 +53,8 @@ $ make doc
5253
$ google-chrome ../doc/html/index.html
5354
```
5455

56+
The documentation is also built hourly and available at [netopeer.liberouter.org](https://netopeer.liberouter.org/doc/libyang/master/).
57+
5558
### Useful CMake Options
5659

5760
#### Changing Compiler
@@ -113,6 +116,16 @@ linker. To help with setting all the compiler's options, there is `libyang.pc` f
113116
If you are using `cmake` in you project, it is also possible to use the provided
114117
`FindLibYANG.cmake` file to detect presence of the libyang library in the system.
115118

119+
## yanglint
120+
121+
libyang project includes features rich tool called `yanglint(1)` for validation
122+
and conversion of the schemas and YANG modeled data. The source codes are
123+
located at [`/tools/lint`](./tools/lint) and can be used to explore how an
124+
application is supposed to use the libyang library. `yanglint(1)` binary as
125+
well as its man page are installed together with the library itself.
126+
127+
There is also [README](./tools/lint/examples/README.md) describing some examples of
128+
using `yanglint`.
116129

117130
## Tests
118131

@@ -157,14 +170,4 @@ Currently supported bindings are:
157170
* cmake option: `JAVASCRIPT_BINDING`
158171
* [README](./swig/javascript/README.md)
159172

160-
## yanglint
161-
162-
libyang source codes include a simple example tool to demanstrate how an application
163-
can work with the libyang library. The tool is called `yanglint`. It is not being
164-
installed together with the library itself, but it is built together with the library
165-
binary and you can find it in [`tools/lint`](./tools/lint) directory.
166-
167-
There is also [README](./tools/lint/examples/README.md) describing some examples of
168-
using `yanglint`.
169-
170173

libyang.pc.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
prefix=@CMAKE_INSTALL_PREFIX@
2-
includedir=${prefix}/@INCLUDE_INSTALL_DIR@
3-
libdir=${prefix}/@LIB_INSTALL_DIR@
2+
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
3+
libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
44

55
Name: @PROJECT_NAME@
66
Description: @LIBYANG_DESCRIPTION@

0 commit comments

Comments
 (0)