{"action":"created","issue":{"url":"https://api.github.com/repos/CESNET/libyang/issues/505","repository_url":"https://api.github.com/repos/CESNET/libyang","labels_url":"https://api.github.com/repos/CESNET/libyang/issues/505/labels{/name}","comments_url":"https://api.github.com/repos/CESNET/libyang/issues/505/comments","events_url":"https://api.github.com/repos/CESNET/libyang/issues/505/events","html_url":"https://github.com/CESNET/libyang/pull/505","id":324884635,"number":505,"title":"add static compile support","user":{"login":"mislavn","id":4980289,"avatar_url":"https://avatars2.githubusercontent.com/u/4980289?v=4","gravatar_id":"","url":"https://api.github.com/users/mislavn","html_url":"https://github.com/mislavn","followers_url":"https://api.github.com/users/mislavn/followers","following_url":"https://api.github.com/users/mislavn/following{/other_user}","gists_url":"https://api.github.com/users/mislavn/gists{/gist_id}","starred_url":"https://api.github.com/users/mislavn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mislavn/subscriptions","organizations_url":"https://api.github.com/users/mislavn/orgs","repos_url":"https://api.github.com/users/mislavn/repos","events_url":"https://api.github.com/users/mislavn/events{/privacy}","received_events_url":"https://api.github.com/users/mislavn/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-05-21T11:36:38Z","updated_at":"2018-05-21T11:41:17Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/CESNET/libyang/pulls/505","html_url":"https://github.com/CESNET/libyang/pull/505","diff_url":"https://github.com/CESNET/libyang/pull/505.diff","patch_url":"https://github.com/CESNET/libyang/pull/505.patch"},"body":"Hi, I'm almost done with the static build. I need to add unit tests but before that I would like to discuss a few things.\r\n\r\n1) What do you think about the code generation part in plugin_config.h.in . There are other ways of doing this but with this approach you need to define the lyext_* and lytpe_* plugin's only in one list variable in the cmake file.\r\n```\r\nset(EXTENSIONS_LIST \"nacm\" \"metadata\" \"yangdata\")\r\nset(USER_TYPE_LIST \"user_date_and_time\")\r\n```\r\nThe list applies for shared libraries also.\r\n\r\n2) Now there is one new requirement, the C file must have the same name as the struct:\r\n```\r\nstruct lyext_plugin_list nacm[] = {\r\n    {\"ietf-netconf-acm\", \"2012-02-22\", \"default-deny-write\", &nacm_deny_write},\r\n    {\"ietf-netconf-acm\", \"2012-02-22\", \"default-deny-all\", &nacm_deny_all},\r\n    {NULL, NULL, NULL, NULL} /* terminating item */\r\n};\r\n\r\n```\r\nor\r\n```\r\nstruct lytype_plugin_list user_date_and_time[] = {\r\n    {\"ietf-yang-types\", \"2013-07-15\", \"date-and-time\", date_and_time_store_clb, NULL},\r\n    {NULL, NULL, NULL, NULL, NULL} /* terminating item */\r\n};\r\n```\r\nThat's because of the list's EXTENSIONS_LIST and USER_TYPE_LIST.\r\n\r\n3) There is a compiler warning for yanglint:\r\nCMakeFiles/yanglint.dir/tools/lint/configuration.c.o: In function `get_yanglint_dir':\r\n/opt/fork/libyang/tools/lint/configuration.c:36: warning: Using 'getpwuid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking\r\n\r\nhttps://github.com/golang/go/issues/13470\r\n\r\nWhich means yanglint will work only if it's compiled with the same version as it's run on the host. We can disable yanglint by default in a static build.\r\n\r\n4) Because of simplicity, for now, in `plugins.c` I add:\r\n```\r\n#ifdef STATIC\r\n    return;\r\n#endif /* STATIC */\r\n```\r\nIf you want we can have two separate files for shared and static build.\r\n\r\n5) What should I do with the ext_test extension on a static build. I was thinking of adding it if the tests are enabled, otherwise not.\r\n\r\nSigned-off-by: Mislav Novakovic <mislav.novakovic@sartura.hr>"},"comment":{"url":"https://api.github.com/repos/CESNET/libyang/issues/comments/390630720","html_url":"https://github.com/CESNET/libyang/pull/505#issuecomment-390630720","issue_url":"https://api.github.com/repos/CESNET/libyang/issues/505","id":390630720,"user":{"login":"mislavn","id":4980289,"avatar_url":"https://avatars2.githubusercontent.com/u/4980289?v=4","gravatar_id":"","url":"https://api.github.com/users/mislavn","html_url":"https://github.com/mislavn","followers_url":"https://api.github.com/users/mislavn/followers","following_url":"https://api.github.com/users/mislavn/following{/other_user}","gists_url":"https://api.github.com/users/mislavn/gists{/gist_id}","starred_url":"https://api.github.com/users/mislavn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mislavn/subscriptions","organizations_url":"https://api.github.com/users/mislavn/orgs","repos_url":"https://api.github.com/users/mislavn/repos","events_url":"https://api.github.com/users/mislavn/events{/privacy}","received_events_url":"https://api.github.com/users/mislavn/received_events","type":"User","site_admin":false},"created_at":"2018-05-21T11:41:17Z","updated_at":"2018-05-21T11:41:17Z","author_association":"NONE","body":"I'll add support for static swig bindings after I'm done with the unit tests."}}
{"actor":{"display_login":"mislavn"}}