From owner-freebsd-questions@FreeBSD.ORG Wed May 20 17:46:01 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AB54B106564A for ; Wed, 20 May 2009 17:46:01 +0000 (UTC) (envelope-from fkeymo@gmail.com) Received: from yx-out-2324.google.com (yx-out-2324.google.com [74.125.44.30]) by mx1.freebsd.org (Postfix) with ESMTP id 5F5C28FC15 for ; Wed, 20 May 2009 17:46:00 +0000 (UTC) (envelope-from fkeymo@gmail.com) Received: by yx-out-2324.google.com with SMTP id 8so364970yxb.13 for ; Wed, 20 May 2009 10:46:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=+esmOTdPWZdYxEf4vT8pwm4sfFJUa2XZe3/Ulu1HyNI=; b=Zuqt368tEk6geP44728E91x/8DTx5f8jit5xO6hb7U52iglkNuTFStAiN88LvJqnFr x7+6TdNIPBTRsv/aB7p9H7De/WZ+3xBZCuCDEsxt/tnttMoC4EOrsfe+j6BIQchy1T5t fo0NUXbBchR++ZxUTq4uUnMkNlFiNi+3+yg8o= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=ggVdo9wEnZZfu3TK9ZIOK4CEhyVw95t9mm9JRXO3P4KaQQDiItykimrM6HTklMltJG BgK8jNXSFf8W7UVQFJcpXNqCScUpGLpgsJYeCdXyXPuBmGaEfmMJvefuhnjg5L7pqfQ9 PCXu07MuPUHH91Rw+f1Z35qr+2OrnCts++LBo= MIME-Version: 1.0 Received: by 10.100.166.7 with SMTP id o7mr3091854ane.90.1242841559948; Wed, 20 May 2009 10:45:59 -0700 (PDT) In-Reply-To: <4A135119.8010007@telenix.org> References: <20090520000137.3d46fcb2.freebsd@edvax.de> <4A135119.8010007@telenix.org> Date: Wed, 20 May 2009 14:45:59 -0300 Message-ID: From: francis keyes To: Chuck Robey Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Polytropon , freebsd-questions@freebsd.org Subject: Re: compiling FreeBSD date on Linux X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 May 2009 17:46:01 -0000 Hmm... the date program looks pretty simple but I don't understand the Makfile: # @(#)Makefile 8.1 (Berkeley) 5/31/93 # $FreeBSD: src/bin/date/Makefile,v 1.11.30.1 2009/04/15 03:14:26 kensmith Exp $ PROG= date SRCS= date.c netdate.c vary.c DPADD= ${LIBUTIL} LDADD= -lutil .include Would it be possible to compile this without a makefile? On Tue, May 19, 2009 at 9:38 PM, Chuck Robey wrote: > Polytropon wrote: > > On Tue, 19 May 2009 18:19:21 -0300, francis keyes > wrote: > >> I would like to compile the FreeBSD date command for use on Linux > because > >> the FreeBSD version has some features that are not present in Linux. > >> I downloaded all the files from > >> http://www.freebsd.org/cgi/cvsweb.cgi/src/bin/date/ and tried to > compile it > >> but I get an error from the Makefile: > >> Makefile:9: *** missing separator. Stop. > > > > First of all, it seems that it's not that easy. FreeBSD's make > > is, if I am correct, a different one than the Linux make. It > > uses - if you look into date's Makefile, an include file, > > named bsd.prog.mk which is located outside of the date/ directory, > > this is /usr/share/mk/bsd.prog.mk or /usr/src/share/mk/bsd.prog.mk > > or /usr/src/tools/build/mk/bsd.prog.mk. You could try to write > > an own Makefile on Linux, or try to work without one... > > > > > > > >> I suspect this is the first of many errors I will run into during this > >> process. Can anyone help me out with this or tell me if there is an > easier > >> way to get this version of the date command running in Linux? > > > > I'm not sure, but it's possible that FreeBSD can be used to > > compile date so it will run on Linux (cross-compier). Because > > I never tried this, I can't tell you how to achieve this. > > > > Furthermore, I'm not sure in how far date hooks into the FreeBSD > > kernel in order to work. It's completely possible that it would > > be easier to implement FreeBSD's date functionality in Linux's > > date command itself ("from scratch"). > > The code isn't all that hard to port, unless you're at a very basic level > with > C. The compatibility level between the BSD Make (bmake) and the GNU Make > (gmake) isn't all that great. One killer problem is that gmake hasn't got > any > concept of a single central include directory, for automatically building > up a > per machine make environment. Gmake can do the including (using a protocol > which is unfortunately different than that of bmake) BUT you can't just > rely on > gmake looking into the bmake central directory (/usr/share/mk) for make > include > files. All of those are named like "bsd.port.mk", in that they all begin > with > "bsd." and end in ".mk", and there isn't any portability between bmake and > gmake > on those include files. I have personally (in the past) written up a set > of > gmake compatible include files, so it CAN be done, but you getter have your > hard > hat on, it's not all that simple to do. > > The various timing commands in either the bsd libc or the Linux glibc look > much > alike, so the porting isn't all that hard, once you conquer the makefiles. > > > > >