Repository: lucy-clownfish
Updated Branches:
  refs/heads/master 064fbd07b -> 6b9abca6f


Adjust Go bindings for new include dir layout


Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/6b9abca6
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/6b9abca6
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/6b9abca6

Branch: refs/heads/master
Commit: 6b9abca6f337bbb33d51002782ad65f337a086a7
Parents: 064fbd0
Author: Nick Wellnhofer <[email protected]>
Authored: Fri Jul 22 15:39:37 2016 +0200
Committer: Nick Wellnhofer <[email protected]>
Committed: Fri Jul 22 15:39:37 2016 +0200

----------------------------------------------------------------------
 compiler/go/cfc/cfc.go     | 6 ++++++
 compiler/src/CFCBindCore.c | 2 +-
 runtime/go/build.go        | 9 +++++----
 3 files changed, 12 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/6b9abca6/compiler/go/cfc/cfc.go
----------------------------------------------------------------------
diff --git a/compiler/go/cfc/cfc.go b/compiler/go/cfc/cfc.go
index 04004e2..d24f957 100644
--- a/compiler/go/cfc/cfc.go
+++ b/compiler/go/cfc/cfc.go
@@ -164,6 +164,12 @@ func (obj *BindCore) WriteAllModified(modified bool) bool {
        return C.CFCBindCore_write_all_modified(obj.ref, mod) != 0
 }
 
+func (obj *BindCore) CopyHeaders(destDir string) {
+       destDirCString := C.CString(destDir)
+       defer C.free(unsafe.Pointer(destDirCString))
+       C.CFCBindCore_copy_headers(obj.ref, destDirCString)
+}
+
 func NewBindC(hierarchy *Hierarchy, header string, footer string) *BindC {
        headerCString := C.CString(header)
        footerCString := C.CString(footer)

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/6b9abca6/compiler/src/CFCBindCore.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCBindCore.c b/compiler/src/CFCBindCore.c
index 138297a..c835cc9 100644
--- a/compiler/src/CFCBindCore.c
+++ b/compiler/src/CFCBindCore.c
@@ -698,7 +698,7 @@ void
 CFCBindCore_copy_headers(CFCBindCore *self, const char *dest_dir) {
     char *default_dest = NULL;
 
-    if (dest_dir == NULL) {
+    if (dest_dir == NULL || dest_dir[0] == '\0') {
         default_dest = CFCUtil_sprintf("%s" CHY_DIR_SEP "share" CHY_DIR_SEP
                                        "clownfish" CHY_DIR_SEP "include",
                                        CFCHierarchy_get_dest(self->hierarchy));

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/6b9abca6/runtime/go/build.go
----------------------------------------------------------------------
diff --git a/runtime/go/build.go b/runtime/go/build.go
index 46d70cc..6990749 100644
--- a/runtime/go/build.go
+++ b/runtime/go/build.go
@@ -132,6 +132,7 @@ func runCFC() {
                specMethods(parcel)
                packageDir := path.Join(buildDir, "clownfish")
                goBinding.WriteBindings(parcel, packageDir)
+               coreBinding.CopyHeaders("")
                hierarchy.WriteLog()
        }
 }
@@ -214,11 +215,11 @@ func copyFile(source, dest string) {
 }
 
 func installHeaders() {
-       coreDir := "../core"
+       srcDir := path.Join("autogen", "share", "clownfish", "include")
        incDir := cfc.MainIncludeDir()
        doInstall := func(source string, info os.FileInfo, err error) error {
-               if strings.HasSuffix(source, ".cfp") || 
strings.HasSuffix(source, ".cfh") {
-                       dest := path.Join(incDir, strings.TrimPrefix(source, 
coreDir))
+               if info.Mode().IsRegular() {
+                       dest := path.Join(incDir, strings.TrimPrefix(source, 
srcDir))
                        destDir := path.Dir(dest)
                        if _, err := os.Stat(destDir); os.IsNotExist(err) {
                                err = os.MkdirAll(destDir, 0755)
@@ -231,7 +232,7 @@ func installHeaders() {
                }
                return nil
        }
-       filepath.Walk("../core", doInstall)
+       filepath.Walk(srcDir, doInstall)
 }
 
 func installStaticLib() {

Reply via email to