OSDN Git Service

Add build option for <features.h> sample distribution.
authorKeith Marshall <keith@users.osdn.me>
Sat, 2 Feb 2019 23:50:04 +0000 (23:50 +0000)
committerKeith Marshall <keith@users.osdn.me>
Sat, 2 Feb 2019 23:50:04 +0000 (23:50 +0000)
Makefile.in
configure.ac
mingwrt/ChangeLog

index 07a23ee..7695d61 100644 (file)
@@ -7,7 +7,7 @@ PACKAGE_TARNAME := @PACKAGE_TARNAME@
 PACKAGE_VERSION := @PACKAGE_VERSION@
 
 # Written by Keith Marshall <keithmarshall@users.sourceforge.net>
-# Copyright (C) 2016, MinGW.org Project
+# Copyright (C) 2016, 2019, MinGW.org Project
 #
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
@@ -35,6 +35,12 @@ PACKAGE_VERSION := @PACKAGE_VERSION@
 #
 all:
 
+# Offer users the opportunity to assign boolean build-time options, from
+# the command line, in the form 'option=NAME', or 'options="NAME ..."'
+#
+$(foreach opt,$(option) $(options),$(eval $(opt) = true))
+
+
 # Configuration
 # -------------
 #
@@ -99,11 +105,47 @@ check-recursive: %: %-subdirs
 MKDIR_P = @MKDIR_P@
 LN = @LN@
 
-dist: dist-subdirs
+dist-prepare:
        $(RM) -r $@; $(MKDIR_P) $@
+
+dist: dist-prepare dist-subdirs dist-extra
        for file in $(addsuffix /$@/*,${subdirs}); do \
          test -f $$file && $(LN) $$file $@; done
 
+LUA = @LUA@
+LUACMD = $(if $(LUA),$(LUA) -e,false)
+
+WSL_TMPDIR = $(CURDIR)/dist/var/lib/wsl
+FEATURES_CFG = wsl-features-$(TODAY)-$(ISSUE)-mingw32-cfg.tar.xz
+
+TODAY = $(shell date +%Y%m%d)
+ISSUE = $(if $(wildcard $@),$(shell awk '\
+  { if( $$1 == $(TODAY) ) print $$2 + 1; else print 1; exit; \
+  }' $@),1)
+
+dist-extra: $(if $(FEATURES),features.stamp)
+features.unsupported:
+       $(warning Lua does not appear to be installed on your system;)
+       $(warning it is required to support the FEATURES distribution option.)
+
+vpath features.lua ${srcdir}/var
+features.stamp: features.$(if $(LUA),lua,unsupported)
+       $(RM) -r dist/var dist/include
+       $(MKDIR_P) dist/include $(WSL_TMPDIR)/include && $(LN) $^ $(WSL_TMPDIR)
+       MINGW32_SYSROOT=$(WSL_TMPDIR) $(LUACMD) '$(FEATURES_H_INITIALIZE)'
+       cd dist && tar cf - var include | xz -c > $(FEATURES_CFG)
+       echo $(TODAY) $(ISSUE) > $@
+       $(RM) -r dist/var dist/include
+
+FEATURES_H_INITIALIZE = \
+  sysroot = os.getenv( "MINGW32_SYSROOT" ) \
+  if sysroot then \
+     package.path = sysroot.."/?.lua;"..package.path \
+     have_features, config = pcall( require, "features" ) \
+     if have_features then \
+       config.initialize( io.open( config.pathname(), "w" )) \
+     end \
+  end
 
 # Clean-up Rules
 # --------------
index 39303e1..7b35e6f 100644 (file)
@@ -6,7 +6,7 @@
 # $Id$
 #
 # Written by Keith Marshall <keithmarshall@users.sourceforge.net>
-# Copyright (C) 2016, MinGW.org Project
+# Copyright (C) 2016, 2019, MinGW.org Project
 #
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
@@ -34,6 +34,7 @@
 
   AC_PROG_MKDIR_P
   AC_PATH_PROG([LN],[ln],[ln])
+  AC_PATH_PROG([LUA],[lua])
 
   AC_CONFIG_SUBDIRS([mingwrt w32api])
   AC_CONFIG_FILES([Makefile])
index 9e450d1..a79e3dc 100644 (file)
@@ -1,3 +1,21 @@
+2019-02-02  Keith Marshall  <keith@users.osdn.me>
+
+       Add build option for <features.h> sample distribution.
+
+       * configure.ac (lua): Add AC_PATH_PROG check; assign result to...
+       (LUA): ...this new AC_SUBST propagated macro definition.
+
+       * Makefile.in (dist): Add dependencies on...
+       (dist-prepare, dist-extra): ...these new goals; implement...
+       (dist-prepare): ...to initialize an empty staging directory, and...
+       (dist-extra): ...incorporate optional distributable components.
+       (features.stamp): New optional goal; selected by definition of...
+       (FEATURES): ...this user specified macro, nominally defined by...
+       (option, options): ...evaluation of command line assignment.
+       (features.lua, features.unsupported): New prerequisite goals.
+       (WSL_TMPDIR, FEATURES_H_INITIALIZE, FEATURES_CFG, LUA, LUACMD)
+       (TODAY, ISSUE): New supporting macros; define them.
+
 2019-01-22  Keith Marshall  <keith@users.osdn.me>
 
        Prepare and publish MinGW.org WSL-5.2.1 release.