From owner-freebsd-ports@freebsd.org Sat Nov 25 03:57:13 2017 Return-Path: Delivered-To: freebsd-ports@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C72E9DFDC04 for ; Sat, 25 Nov 2017 03:57:13 +0000 (UTC) (envelope-from adamw@adamw.org) Received: from apnoea.adamw.org (apnoea.adamw.org [104.225.5.94]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "apnoea.adamw.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C82627202A for ; Sat, 25 Nov 2017 03:57:12 +0000 (UTC) (envelope-from adamw@adamw.org) Received: by apnoea.adamw.org (OpenSMTPD) with ESMTPSA id f767d341 TLS version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO; Fri, 24 Nov 2017 20:57:09 -0700 (MST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 11.1 \(3445.4.7\)) Subject: Re: a project with custom makefile From: Adam Weinberger In-Reply-To: Date: Fri, 24 Nov 2017 20:57:07 -0700 Cc: FreeBSD Ports Content-Transfer-Encoding: quoted-printable Message-Id: <0F82F594-2D9B-48A2-99B0-909A6105D96D@adamw.org> References: <90470926-1E50-4CD9-A797-9D013B9B68D5@adamw.org> To: blubee blubeeme X-Mailer: Apple Mail (2.3445.4.7) X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Nov 2017 03:57:13 -0000 > On 24 Nov, 2017, at 20:42, blubee blubeeme = wrote: >=20 > I apologize for not being clear, I can get really long winded and try = to control myself. > The project that I want to port is nuklear which is a single header = gui library: https://github.com/vurtun/nuklear >=20 > If you look at the source code then demo folder: = https://github.com/vurtun/nuklear/tree/master/demo > you'll see there are demos for practically every rendering backend = from x11 to glfw. >=20 > I like this because it makes GUI very easy and I can avoid a lot of = the troubles with bigger packages such as QT, Gnome, etc... >=20 > Let's look at the simplest project which is demo/x11: = https://github.com/vurtun/nuklear/tree/master/demo/x11 >=20 > There's the makefile and main.c and the nuklear_xlib.h header. >=20 > The makefile is very straight forward: = https://github.com/vurtun/nuklear/blob/master/demo/x11/Makefile > but it doesn't fit in with the FreeBSD build system or at least I = don't really get how to make things build smoothly. >=20 > My current ports makefile looks like this: >=20 > OPTIONS_DEFINE=3D x11 >=20 > x11_DESC=3D Nuklear X11 Demo >=20 > USE_GITHUB=3D yes > GH_ACCOUNT=3D vurtun > GH_TAGNAME=3D 36a396f >=20 > .include > do-build: > .if ${PORT_OPTIONS:Mx11} > @(${DO_MAKE_BUILD} -C ${WRKSRC}/demo/x11/) > .endif > .include >=20 > Initially I was using replace cmd and sed to change parts of the files = but that got really tedious so I made a patch file: >=20 > --- demo/x11/Makefile.orig 2017-11-24 21:08:07 UTC > +++ demo/x11/Makefile > @@ -1,8 +1,8 @@ > # Install > -BIN =3D zahnrad > +BIN =3D x11-zahnrad > =20 > # Flags > -CFLAGS =3D -std=3Dc89 -pedantic -O2 > +CFLAGS =3D -std=3Dc89 -pedantic -O2 `pkg-config --cflags --libs x11` > =20 > SRC =3D main.c > OBJ =3D $(SRC:.c=3D.o) >=20 > That's obviously wrong, maybe I'll have to change the ${WRKSRC} = depending on the options that's selected > or > write a cmake file and get that upstreamed to the developer. >=20 > I'd think cmake might be a better option since it's easier to maintain = in the long run. >=20 > Hope this clarifies what I'm trying to do and I'd still like some = feedback as to which path the community would recommend; writing a cmake = file, make many patch files and deal with that possibly breaking in the = future or some other options that I didn't think about yet? The error that you gave earlier says that there's no Makefile in = ${WRKSRC}. The default do-install essentially runs "make -C ${WRKSRC} = install", so without a Makefile, it produces an error. Writing cmake files seems pretty overkill. Your port appears to build = just one file. So just make your own do-install: target and install the = files yourself. There are 5,995 examples of this in the ports tree, and = the Porter's Handbook has an entire section on installing files. # Adam --=20 Adam Weinberger adamw@adamw.org https://www.adamw.org