From owner-freebsd-bugs Thu Jan 10 18:30:17 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 951DB37B419 for ; Thu, 10 Jan 2002 18:30:01 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g0B2U1W89856; Thu, 10 Jan 2002 18:30:01 -0800 (PST) (envelope-from gnats) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 825EA37B404 for ; Thu, 10 Jan 2002 18:28:14 -0800 (PST) Received: (from nobody@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g0B2SEr89565; Thu, 10 Jan 2002 18:28:14 -0800 (PST) (envelope-from nobody) Message-Id: <200201110228.g0B2SEr89565@freefall.freebsd.org> Date: Thu, 10 Jan 2002 18:28:14 -0800 (PST) From: Sam Leffler To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-1.0 Subject: misc/33778: crunchgen enhancements Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 33778 >Category: misc >Synopsis: crunchgen enhancements >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Thu Jan 10 18:30:01 PST 2002 >Closed-Date: >Last-Modified: >Originator: Sam Leffler >Release: 4.5-PRERELEASE >Organization: >Environment: >Description: crunchgen is hard to use for certain programs because you can't specify per-prog libraries to link into the .lo. An example is dhcpd in ISC DHCP v3.0.1r4. Included is a change to crunchgen.c that implements special lib Also included is a "hack" to permit passing make variables through to the generated .mk file. This lets you, for example, specify common pathnames in one place. >How-To-Repeat: >Fix: cut&paste will ruin this diff so you'll probably want to ask me to send it by mail. RCS file: /usr/ncvs/src/usr.sbin/crunch/crunchgen/crunchgen.c,v retrieving revision 1.12.2.9 diff -r1.12.2.9 crunchgen.c 75a76 > strlst_t *libs; 85a87 > strlst_t *vars = NULL; 241a244 > void add_var(int argc, char **argv); 295a299,300 > else if(!strcmp(fieldv[0], "var")) > f = add_var; 411a417 > p2->libs = NULL; 457a464,472 > void add_var(int argc, char **argv) > { > int i; > > for (i = 1; i < argc; i++) > add_string(&vars, argv[i]); > } > > 508a524,526 > } else if (!strcmp(argv[2], "lib")) { > for (i = 3; i < argc; i++) > add_string(&p->libs, argv[i]); 580a599 > strlst_t *s; 595c614,620 < snprintf(line, MAXLINELEN, "cd %s && echo -n `/bin/pwd`", --- > char *cp = line; > for (s = vars; s != NULL; s = s->next) { > snprintf(cp, MAXLINELEN - (cp-line), "%s;", s->str); > cp = strchr(cp, '\0'); > } > snprintf(cp, MAXLINELEN - (cp-line), > "cd %s && echo -n `/bin/pwd`", 635c660 < snprintf(path, sizeof(path), "%s/Makefile", p->srcdir); --- > snprintf(path, sizeof(path), "%s/Makefile", p->realsrcdir); 679a705,706 > for (s = vars; s != NULL; s = s->next) > fprintf(f, "%s\n", s->str); 916a944,947 > strlst_t *s; > > for (s = vars; s != NULL; s = s->next) > fprintf(outmk, "%s\n", s->str); 1012a1044,1047 > if (p->libs) { > fprintf(outmk, "%s_LIBS=", p->ident); > output_strlst(outmk, p->libs); > } 1019c1054 < fprintf(outmk, "%s.lo: %s_stub.o $(%s_OBJPATHS)\n", --- > fprintf(outmk, "%s.lo: %s_stub.o $(%s_OBJPATHS)", 1021c1056,1059 < fprintf(outmk, "\tld -dc -r -o %s.lo %s_stub.o $(%s_OBJPATHS)\n", --- > if (p->libs) > fprintf(outmk, " $(%s_LIBS)", p->ident); > fprintf(outmk, "\n"); > fprintf(outmk, "\tld -dc -r -o %s.lo %s_stub.o $(%s_OBJPATHS)", 1022a1061,1063 > if (p->libs) > fprintf(outmk, " $(%s_LIBS)", p->ident); > fprintf(outmk, "\n"); >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message