From 76034ae4d7db051d0dd351e9880b8322c6db5883 Mon Sep 17 00:00:00 2001 From: Joe Rozner Date: Thu, 21 Nov 2013 12:02:18 -0800 Subject: [PATCH 1/4] Install internal headers for Go bindings Go, and likely other language bindings will, need access to create new combinators. This functionality is currently located src/parsers/parser_internal.h. Install this header to the system with dependent headers until a better solution can be found. --- SConstruct | 4 ++++ src/SConscript | 14 +++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/SConstruct b/SConstruct index 422efe6..ebed8b4 100644 --- a/SConstruct +++ b/SConstruct @@ -28,6 +28,8 @@ if 'DESTDIR' in env: env['libpath'] = calcInstallPath("$prefix", "lib") env['incpath'] = calcInstallPath("$prefix", "include", "hammer") +env['parsersincpath'] = calcInstallPath("$prefix", "include", "hammer", "parsers") +env['backendsincpath'] = calcInstallPath("$prefix", "include", "hammer", "backends") env['pkgconfigpath'] = calcInstallPath("$prefix", "lib", "pkgconfig") env.ScanReplace('libhammer.pc.in') @@ -90,4 +92,6 @@ env.Command('test', 'build/$VARIANT/src/test_suite', 'env LD_LIBRARY_PATH=build/ env.Alias("install", "$libpath") env.Alias("install", "$incpath") +env.Alias("install", "$parsersincpath") +env.Alias("install", "$backendsincpath") env.Alias("install", "$pkgconfigpath") diff --git a/src/SConscript b/src/SConscript index a06244b..1d9ca76 100644 --- a/src/SConscript +++ b/src/SConscript @@ -6,7 +6,17 @@ bindings = [] dist_headers = [ "hammer.h", "allocator.h", - "glue.h" + "glue.h", + "internal.h" +] + +parsers_headers = [ + "parsers/parser_internal.h" +] + +backends_headers = [ + "backends/regex.h", + "backends/contextfree.h" ] parsers = ['parsers/%s.c'%s for s in @@ -64,6 +74,8 @@ libhammer_static = env.StaticLibrary('hammer', parsers + backends + misc_hammer_ env.Install("$libpath", [libhammer_static, libhammer_shared]) env.Install("$incpath", dist_headers) +env.Install("$parsersincpath", parsers_headers) +env.Install("$backendsincpath", backends_headers) env.Install("$pkgconfigpath", "../../../libhammer.pc") testenv = env.Clone() From 1d80058c851fb31dcc46ddcc7ceac12297fa9ca6 Mon Sep 17 00:00:00 2001 From: Joe Rozner Date: Thu, 21 Nov 2013 12:37:36 -0800 Subject: [PATCH 2/4] Properly name the lib Set the proper path for the shared library so that anything linking against it will be able to find the library. --- SConstruct | 2 ++ 1 file changed, 2 insertions(+) diff --git a/SConstruct b/SConstruct index ebed8b4..0512d71 100644 --- a/SConstruct +++ b/SConstruct @@ -78,6 +78,8 @@ if os.getenv("CC") == "clang" or env['PLATFORM'] == 'darwin': env.Replace(CC="clang", CXX="clang++") +env.Append(SHLINKFLAGS = ['-install_name ' + '$TARGET']) + env["ENV"].update(x for x in os.environ.items() if x[0].startswith("CCC_")) #rootpath = env['ROOTPATH'] = os.path.abspath('.') From d0906e69e6a3cd17e68b43eb83b8e0b522f02fe8 Mon Sep 17 00:00:00 2001 From: Joe Rozner Date: Thu, 21 Nov 2013 12:50:03 -0800 Subject: [PATCH 3/4] Fix for linux This actually is only for OS X. On linux ldconfig must be run after installing in order to update the library cache. Need to look into how to get scons to do this for the user. --- SConstruct | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/SConstruct b/SConstruct index 0512d71..c46c090 100644 --- a/SConstruct +++ b/SConstruct @@ -37,6 +37,7 @@ env.MergeFlags("-std=gnu99 -Wall -Wextra -Werror -Wno-unused-parameter -Wno-attr if not env['PLATFORM'] == 'darwin': env.MergeFlags("-lrt") + env.Append(SHLINKFLAGS = ['-install_name ' + '$TARGET']) AddOption("--variant", dest="variant", @@ -78,8 +79,6 @@ if os.getenv("CC") == "clang" or env['PLATFORM'] == 'darwin': env.Replace(CC="clang", CXX="clang++") -env.Append(SHLINKFLAGS = ['-install_name ' + '$TARGET']) - env["ENV"].update(x for x in os.environ.items() if x[0].startswith("CCC_")) #rootpath = env['ROOTPATH'] = os.path.abspath('.') From bb02aa18e76ed4236526572b3093ce38b64f2fbc Mon Sep 17 00:00:00 2001 From: Joe Rozner Date: Thu, 21 Nov 2013 22:09:25 -0800 Subject: [PATCH 4/4] Add warning message Specify warning for internal only headers that are now installed for use by extensions. --- src/backends/contextfree.h | 5 +++++ src/backends/regex.h | 5 +++++ src/internal.h | 5 +++++ src/parsers/parser_internal.h | 5 +++++ 4 files changed, 20 insertions(+) diff --git a/src/backends/contextfree.h b/src/backends/contextfree.h index b387e55..ab04ab5 100644 --- a/src/backends/contextfree.h +++ b/src/backends/contextfree.h @@ -1,3 +1,8 @@ +/* + * NOTE: This is an internal header and installed for use by extensions. The + * API is not guaranteed stable. +*/ + // This is an internal header; it provides macros to make desugaring cleaner. #include #include "../internal.h" diff --git a/src/backends/regex.h b/src/backends/regex.h index a84904d..4ea85a8 100644 --- a/src/backends/regex.h +++ b/src/backends/regex.h @@ -1,3 +1,8 @@ +/* + * NOTE: This is an internal header and installed for use by extensions. The + * API is not guaranteed stable. +*/ + // Internal defs #ifndef HAMMER_BACKEND_REGEX__H #define HAMMER_BACKEND_REGEX__H diff --git a/src/internal.h b/src/internal.h index c402da5..89cb380 100644 --- a/src/internal.h +++ b/src/internal.h @@ -15,6 +15,11 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +/* + * NOTE: This is an internal header and installed for use by extensions. The + * API is not guaranteed stable. +*/ + #ifndef HAMMER_INTERNAL__H #define HAMMER_INTERNAL__H #include diff --git a/src/parsers/parser_internal.h b/src/parsers/parser_internal.h index aeb202b..ec97dd1 100644 --- a/src/parsers/parser_internal.h +++ b/src/parsers/parser_internal.h @@ -1,3 +1,8 @@ +/* + * NOTE: This is an internal header and installed for use by extensions. The + * API is not guaranteed stable. +*/ + #ifndef HAMMER_PARSE_INTERNAL__H #define HAMMER_PARSE_INTERNAL__H #include "../hammer.h"