From aec4f0db2ddcb89e7f7cdb62bdfed747500c6f2e Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Fri, 18 Aug 2017 14:37:35 +0200 Subject: [PATCH] libc: generate nslexer.c,nsparser.c at build stage The files are generated via flex and bison. Until now, this step was performed when preparing the libc port. Unfortunately, the generated files have subtle differences depending on the flex/bison versions installed in the host. For example, the bison version number appears in the generated code. This, in turn, breaks the hash mechanism of the depot where a src/libc archive ends up being slightly different when created on different hosts. By moving the code generation to the build stage, the src/libc archive merely contains the nslexer.l and nsparser.y source files but not the generated files. --- repos/libports/lib/mk/libc-net.mk | 15 +++++++++++++++ repos/libports/ports/libc.hash | 2 +- repos/libports/ports/libc.port | 25 +++++++------------------ 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/repos/libports/lib/mk/libc-net.mk b/repos/libports/lib/mk/libc-net.mk index 2ad66c89f..87a953780 100644 --- a/repos/libports/lib/mk/libc-net.mk +++ b/repos/libports/lib/mk/libc-net.mk @@ -33,3 +33,18 @@ INC_DIR += $(LIBC_PORT_DIR)/include/libc/sys INC_DIR += $(LIBC_DIR)/lib/libc/resolv vpath %.c $(LIBC_NET_DIR) + +nslexer.o: nsparser.c nsparser.c + +nslexer.c: nslexer.l + $(MSG_CONVERT)$(notdir $@) + $(VERBOSE)flex -P_nsyy -t $< | sed -e '/YY_BUF_SIZE/s/16384/1024/' > $@ + +vpath nslexer.l $(LIBC_NET_DIR) + +nsparser.c: nsparser.y + $(MSG_CONVERT)$(notdir $@) + $(VERBOSE)bison -d -p_nsyy $< \ + --defines=$(LIBC_PORT_DIR)/src/lib/libc/lib/libc/net/nsparser.h --output=$@ + +vpath nsparser.y $(LIBC_NET_DIR) diff --git a/repos/libports/ports/libc.hash b/repos/libports/ports/libc.hash index 2e435f815..5b9e83e52 100644 --- a/repos/libports/ports/libc.hash +++ b/repos/libports/ports/libc.hash @@ -1 +1 @@ -0885f819fb527fb3930cf56b7bc118f364c6f074 +cefebffc6e8f129acb24de192373731461abe2f6 diff --git a/repos/libports/ports/libc.port b/repos/libports/ports/libc.port index 8363990de..6c2cbb095 100644 --- a/repos/libports/ports/libc.port +++ b/repos/libports/ports/libc.port @@ -197,23 +197,6 @@ DIR_CONTENT(include/libc-arm/machine) := \ # Rules for generating files # -generated_files += src/lib/libc/lib/libc/net/nslexer.c - -src/lib/libc/lib/libc/net/nslexer.l : $(DOWNLOADS) - -src/lib/libc/lib/libc/net/nslexer.c: src/lib/libc/lib/libc/net/nslexer.l - @$(MSG_GENERATE)$(notdir $@) - $(VERBOSE)flex -P_nsyy -t $< | sed -e '/YY_BUF_SIZE/s/16384/1024/' > $@ - -generated_files += src/lib/libc/lib/libc/net/nsparser.c - -src/lib/libc/lib/libc/net/nsparser.y : $(DOWNLOADS) - -src/lib/libc/lib/libc/net/nsparser.c: src/lib/libc/lib/libc/net/nsparser.y - @$(MSG_GENERATE)$(notdir $@) - $(VERBOSE)bison -d -p_nsyy $< \ - --defines=src/lib/libc/lib/libc/net/nsparser.h --output=$@ - src/lib/libc/include/rpcsvc/nis.h: src/lib/libc/include/rpcsvc/nis_object.x @$(MSG_GENERATE)$(notdir $@) $(VERBOSE)rpcgen -C -h -DWANT_NFS3 $< -o $@ @@ -224,7 +207,7 @@ src/lib/libc/include/rpcsvc/nis_object.x : $(DOWNLOADS) @$(MSG_GENERATE)$(notdir $@) $(VERBOSE)rpcgen -C -h -DWANT_NFS3 $< -o $@ -generated_files += \ +generated_rpcsvc_files := \ $(addprefix src/lib/libc/include/rpcsvc/,\ bootparam_prot.h nfs_prot.h nlm_prot.h rstat.h ypupdate_prot.h \ crypt.h nis_cache.h pmap_prot.h rwall.h yp.h \ @@ -233,6 +216,12 @@ generated_files += \ mount.h nis.h rquota.h yppasswd.h) \ src/lib/libc/include/rpc/rpcb_prot.h +$(generated_rpcsvc_files:.h=.x): $(DOWNLOADS) + +$(generated_rpcsvc_files) : $(generated_rpcsvc_files:.h=.x) + +generated_files += $(generated_rpcsvc_files) + # generate files before assembling the public include directory tree _dirs: $(generated_files) $(generated_files) : $(DOWNLOADS)