From owner-freebsd-questions@FreeBSD.ORG Wed May 20 19:20:15 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 6F8051065670 for ; Wed, 20 May 2009 19:20:15 +0000 (UTC) (envelope-from rsmith@xs4all.nl) Received: from smtp-vbr16.xs4all.nl (smtp-vbr16.xs4all.nl [194.109.24.36]) by mx1.freebsd.org (Postfix) with ESMTP id 049C08FC21 for ; Wed, 20 May 2009 19:20:14 +0000 (UTC) (envelope-from rsmith@xs4all.nl) Received: from slackbox.xs4all.nl (slackbox.xs4all.nl [213.84.242.160]) by smtp-vbr16.xs4all.nl (8.13.8/8.13.8) with ESMTP id n4KJKCrY095323; Wed, 20 May 2009 21:20:12 +0200 (CEST) (envelope-from rsmith@xs4all.nl) Received: by slackbox.xs4all.nl (Postfix, from userid 1001) id 1F812BAAA; Wed, 20 May 2009 21:20:12 +0200 (CEST) Date: Wed, 20 May 2009 21:20:12 +0200 From: Roland Smith To: francis keyes Message-ID: <20090520192011.GA97805@slackbox.xs4all.nl> References: <20090520000137.3d46fcb2.freebsd@edvax.de> <4A135119.8010007@telenix.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="PEIAKu/WMn1b1Hv9" Content-Disposition: inline In-Reply-To: X-GPG-Fingerprint: 1A2B 477F 9970 BA3C 2914 B7CE 1277 EFB0 C321 A725 X-GPG-Key: http://www.xs4all.nl/~rsmith/pubkey.txt X-GPG-Notice: If this message is not signed, don't assume I sent it! User-Agent: Mutt/1.5.19 (2009-01-05) X-Virus-Scanned: by XS4ALL Virus Scanner Cc: Polytropon , Chuck Robey , 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 19:20:15 -0000 --PEIAKu/WMn1b1Hv9 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, May 20, 2009 at 02:45:59PM -0300, francis keyes wrote: > Hmm... the date program looks pretty simple but I don't understand the > Makfile: >=20 > # @(#)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 $ >=20 > PROG=3D date > SRCS=3D date.c netdate.c vary.c > DPADD=3D ${LIBUTIL} > LDADD=3D -lutil >=20 > .include >=20 >=20 > Would it be possible to compile this without a makefile? Sure. A command like "gcc -o date date.c netdate.c vary.c" works, provided you patch date.c to remove the dependency on libutil (logwtmp function). This will stop date from logging to wtmp(5). ----- patch for date.c ----- --- date.c.orig 2009-05-04 22:09:01.000000000 +0200 +++ date.c 2009-05-20 21:05:32.000000000 +0200 @@ -48,7 +48,7 @@ #include #include #include -#include +/*#include */ #include #include #include @@ -274,12 +274,12 @@ if (!jflag) { /* set the time */ if (nflag || netsettime(tval)) { - logwtmp("|", "date", ""); + /*logwtmp("|", "date", "");*/ tv.tv_sec =3D tval; tv.tv_usec =3D 0; if (settimeofday(&tv, (struct timezone *)NULL)) err(1, "settimeofday (timeval)"); - logwtmp("{", "date", ""); + /*logwtmp("{", "date", "");*/ } =20 if ((p =3D getlogin()) =3D=3D NULL) ----- patch for date.c ----- With this patch, the executable only depends on libc. Note that I have only confirmed that it compiles _on FreeBSD_. There might be additional differences between FreeBSD libc and the GNU libc that is used on Linux that make further tinkering with the source necessary. Roland --=20 R.F.Smith http://www.xs4all.nl/~rsmith/ [plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated] pgp: 1A2B 477F 9970 BA3C 2914 B7CE 1277 EFB0 C321 A725 (KeyID: C321A725) --PEIAKu/WMn1b1Hv9 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.11 (FreeBSD) iEYEARECAAYFAkoUV+sACgkQEnfvsMMhpyW/AQCgmKP0kIapr+Tw2jaZ70pGnA7K pjkAoKNQX+jsAso+wS8OT2BNbO23+yxH =Mwzx -----END PGP SIGNATURE----- --PEIAKu/WMn1b1Hv9--