From owner-svn-src-all@FreeBSD.ORG Tue Sep 11 22:38:34 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 53CD7106566B; Tue, 11 Sep 2012 22:38:34 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 24EC48FC18; Tue, 11 Sep 2012 22:38:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8BMcYgL047307; Tue, 11 Sep 2012 22:38:34 GMT (envelope-from obrien@svn.freebsd.org) Received: (from obrien@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8BMcXCV047303; Tue, 11 Sep 2012 22:38:33 GMT (envelope-from obrien@svn.freebsd.org) Message-Id: <201209112238.q8BMcXCV047303@svn.freebsd.org> From: "David E. O'Brien" Date: Tue, 11 Sep 2012 22:38:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240377 - in head: lib/libmagic tools/build X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Sep 2012 22:38:34 -0000 Author: obrien Date: Tue Sep 11 22:38:33 2012 New Revision: 240377 URL: http://svn.freebsd.org/changeset/base/240377 Log: r235638 is not the clean way to add support for building on ancient FreeBSD versions. Instead use Imp's good work on "legacy" and follow the outcome of the previous TRB discussions on this topic. Now use the libc getline() if it exists, and only where it doesn't create a bootstraping version. Modified: head/lib/libmagic/Makefile head/lib/libmagic/config.h head/tools/build/Makefile Modified: head/lib/libmagic/Makefile ============================================================================== --- head/lib/libmagic/Makefile Tue Sep 11 22:13:37 2012 (r240376) +++ head/lib/libmagic/Makefile Tue Sep 11 22:38:33 2012 (r240377) @@ -39,9 +39,9 @@ magic.mgc: mkmagic magic CLEANFILES+= mkmagic build-tools: mkmagic -mkmagic: apprentice.c encoding.c funcs.c getline.c magic.c print.c - ${CC} ${CFLAGS} -DCOMPILE_ONLY -DHOSTPROG ${LDFLAGS} \ - -o ${.TARGET} ${.ALLSRC} +mkmagic: apprentice.c encoding.c funcs.c magic.c print.c + ${CC} ${CFLAGS} -DCOMPILE_ONLY ${LDFLAGS} -o ${.TARGET} ${.ALLSRC} \ + ${LDADD} FILEVER!= awk '$$1 == "\#define" && $$2 == "VERSION" { print $$3; exit }' \ ${.CURDIR}/config.h Modified: head/lib/libmagic/config.h ============================================================================== --- head/lib/libmagic/config.h Tue Sep 11 22:13:37 2012 (r240376) +++ head/lib/libmagic/config.h Tue Sep 11 22:38:33 2012 (r240377) @@ -39,9 +39,7 @@ #define HAVE_FSEEKO 1 /* Define to 1 if you have the `getline' function. */ -#ifndef HOSTPROG #define HAVE_GETLINE 1 -#endif /* Define to 1 if you have the header file. */ #define HAVE_GETOPT_H 1 Modified: head/tools/build/Makefile ============================================================================== --- head/tools/build/Makefile Tue Sep 11 22:13:37 2012 (r240376) +++ head/tools/build/Makefile Tue Sep 11 22:38:33 2012 (r240377) @@ -3,12 +3,24 @@ .PATH: ${.CURDIR}/../../include LIB= egacy -SRCS= +SRC= INCSGROUPS= INCS -INCS= +INCS= BOOTSTRAPPING?= 0 +_WITH_GETLINE!= grep -c _WITH_GETLINE /usr/include/stdio.h || true +.if ${_WITH_GETLINE} == 0 +.PATH: ${.CURDIR}/../../contrib/file ${.CURDIR}/../../lib/libmagic +SRCS= getline.c config.h +CFLAGS+= -DHAVE_CONFIG_H -I. +CLEANFILES+= config.h + +${SRCS:N*.h:R:S/$/.o/}: config.h +config.h: ${.CURDIR}/../../lib/libmagic/config.h + grep -v HAVE_GETLINE ${.ALLSRC} > ${.TARGET} +.endif + .if empty(SRCS) SRCS= dummy.c .endif