Print this page
OS-2552 add node-lockfd (v0.0.2) to platform
OS-2558 smartos-live should run tools from proto.strap, not proto

@@ -114,10 +114,19 @@
 $(KSTAT.NODE) : CXXFLAGS +=     $(NODE_CFLAGS)
 $(KSTAT.NODE) : LDFLAGS +=      $(NODE_LDFLAGS)
 $(KSTAT.NODE) : LIBS +=         -lkstat
 
 #
+# The lockfd Node add-on is based on v8plus, which has its own system of
+# Makefiles.
+#
+LOCKFD_BINDING.NODE =           node-lockfd/lib/lockfd_binding.node
+
+LOCKFD_SRC_DIR =                $(PWD)/node-lockfd/src
+LOCKFD_V8PLUS_DIR =             $(PWD)/node-lockfd/node_modules/v8plus
+
+#
 # The dtrace-provider add-on uses a combination of C, assembly and C++ files in
 # multiple directories.
 #
 DTRACE_PROVIDER_OBJDIR =        node-dtrace-provider/build/Release
 DTRACE_PROVIDER_SRCDIR =        node-dtrace-provider

@@ -312,10 +321,11 @@
         zfs_send \
         zoneevent \
         $(EXPAT.NODE) \
         $(DTRACE_PROVIDER.NODE) \
         $(KSTAT.NODE) \
+        $(LOCKFD_BINDING.NODE) \
         $(MICROTIME.NODE) \
         $(SYSLOG.NODE) \
         $(SQLITE3_BINDINGS.NODE) \
         $(UUID.NODE) \
         $(ZSOCK_BINDINGS.NODE) \

@@ -342,10 +352,12 @@
         mkdir -p $(DESTDIR)/smartdc/lib
         cp -p $(SMARTDC_LIB_TARGETS) $(DESTDIR)/smartdc/lib
         mkdir -m 0755 -p $(PREFIX_NODE)/node_modules
         cp -Pr node_modules/* $(PREFIX_NODE)/node_modules
         cp $(KSTAT.NODE) $(PREFIX_NODE)/node_modules/
+        cp node-lockfd/lib/index.js $(PREFIX_NODE)/node_modules/lockfd.js
+        cp $(LOCKFD_BINDING.NODE) $(PREFIX_NODE)/node_modules/lockfd_binding.node
         cp $(MICROTIME.NODE) $(PREFIX_NODE)/node_modules/
         rm -rf $(DESTDIR)/usr/vm
         cp -PR vm $(DESTDIR)/usr/
         mkdir -m 0755 -p $(DESTDIR)/usr/vm/node_modules
         mkdir -p $(PREFIX_NODE)/node_modules/{zsock,zutil}/build/Release

@@ -460,10 +472,11 @@
 
 clean:
         -rm -f $(TARGETS) $(SMARTDC_TARGETS) $(SMARTDC_LIB_TARGETS) *.o \
             $(CLEANFILES)
         -rm -rf node-sqlite3/build
+        cd $(LOCKFD_SRC_DIR) && $(MAKE) clean
 
 include Makefile.targ
 
 #
 # Custom rules for building our various real targets follow.  Generic rules

@@ -494,10 +507,27 @@
 $(EXPAT.NODE): node-expat/node-expat.cc
         @mkdir -p $(EXPAT_OBJDIR)
         $(GXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@ $< $(LIBS)
 
 #
+# node-lockfd is built using the v8plus-based Makefile contained within the
+# project.  We use LD_OPTIONS, here, to induce the linker to include libc,
+# which gcc as configured in proto.strap does not, but which other C compilers
+# generally do.
+#
+$(LOCKFD_BINDING.NODE): FRC
+        cd $(LOCKFD_SRC_DIR) && \
+        LD_OPTIONS=-lc \
+        $(MAKE) \
+                CC=$(GCC) CXX=$(GXX) \
+                PREFIX_NODE=$(PREFIX_NODE) \
+                NODE_EXEC=$(NODE_EXEC) \
+                V8PLUS=$(LOCKFD_V8PLUS_DIR) \
+                CTFCONVERT=$(CTFCONVERT) \
+                CTFMERGE=$(CTFMERGE)
+
+#
 # The next two are used to build libusdt files into
 # $(DTRACE_PROVIDER_OBJDIR)/libusdt/*.o, instead of building libusdt.a
 #
 $(DTRACE_PROVIDER_OBJDIR)/%.o: $(DTRACE_PROVIDER_SRCDIR)/%.c \
             $(DTRACE_PROVIDER_HDRS)

@@ -551,5 +581,7 @@
         @mkdir -p $(ZUTIL_OBJDIR)
         $(GXX) $(CPPFLAGS) $(CXXFLAGS) -o $@ -c $<
 
 $(ZUTIL_BINDINGS.NODE): $(ZUTIL_BINDINGS_OBJS)
         $(GXX) $(LDFLAGS) -o $@ $(ZUTIL_BINDINGS_OBJS) $(LIBS)
+
+FRC: