Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 24 Nov 2017 21:04:53 -0700
From:      Adam Weinberger <adamw@adamw.org>
To:        blubee blubeeme <gurenchan@gmail.com>
Cc:        FreeBSD Ports <freebsd-ports@freebsd.org>
Subject:   Re: a project with custom makefile
Message-ID:  <52C2A6E6-F4CE-4A2C-A6D0-153FC71250C0@adamw.org>
In-Reply-To: <CALM2mEk4y=wrL6oXyjj8C1Bt%2B9ehv6fTiv0OJnYmmA_A6odbgw@mail.gmail.com>
References:  <CALM2mEmzY8uNpbjfP5DUTd1YEMxbtjyA0zaz%2Bhkd9UM6jZHuzQ@mail.gmail.com> <90470926-1E50-4CD9-A797-9D013B9B68D5@adamw.org> <CALM2mE=Ma=sGE=0N_Bzri8vwECW%2Bq%2BcvxiLvfGPBPoimo%2Bm5Tw@mail.gmail.com> <0F82F594-2D9B-48A2-99B0-909A6105D96D@adamw.org> <CALM2mEk4y=wrL6oXyjj8C1Bt%2B9ehv6fTiv0OJnYmmA_A6odbgw@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
> On 24 Nov, 2017, at 21:02, blubee blubeeme <gurenchan@gmail.com> =
wrote:
>=20
> the x11 was just the first example, there's a total of about 15 =
different projects
>=20
> OPTIONS_DEFINE=3D	x11 x11_rawfb x11_gl2 x11_gl3	\
> 		allegro5 gdi gdip glfw2 glfw3	\
> 		sdl_gl2 sdl_gl3 sdl_gles2	\
> 		sfml_gl2 sfml_gl3
>=20
> there's also a few direct X projects but those do not build on FreeBSD =
as far as I know. Not only that but the projects are different, for =
example glfw, sdl and a few others support HiDPI support, that means =
that I can build GUI that are scaled properly based on the resolution of =
my screen and not look super tiny. the x11 versions doesn't support =
those scaling options.

Please, "blubee," stop top-posting. FreeBSD lists are bottom-post only.

This is what OPTIONS helpers are for.

do-install-X11-on:
	${INSTALL_PROGRAM} ....

do-install-X11_RAWFB-on:
	${INSTALL_PROGRAM} ....

Also. Options MUST be uppercase. There are no exceptions to this.

# Adam


--=20
Adam Weinberger
adamw@adamw.org
https://www.adamw.org


>=20
>=20
> On Sat, Nov 25, 2017 at 11:57 AM, Adam Weinberger <adamw@adamw.org> =
wrote:
> > On 24 Nov, 2017, at 20:42, blubee blubeeme <gurenchan@gmail.com> =
wrote:
> >
> > 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
> >
> > 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.
> >
> > 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...
> >
> > Let's look at the simplest project which is demo/x11: =
https://github.com/vurtun/nuklear/tree/master/demo/x11
> >
> > There's the makefile and main.c and the nuklear_xlib.h header.
> >
> > 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.
> >
> > My current ports makefile looks like this:
> >
> > OPTIONS_DEFINE=3D       x11
> >
> > x11_DESC=3D     Nuklear X11 Demo
> >
> > USE_GITHUB=3D   yes
> > GH_ACCOUNT=3D   vurtun
> > GH_TAGNAME=3D   36a396f
> >
> > .include <bsd.port.pre.mk>
> > do-build:
> > .if ${PORT_OPTIONS:Mx11}
> >       @(${DO_MAKE_BUILD} -C ${WRKSRC}/demo/x11/)
> > .endif
> > .include <bsd.port.post.mk>
> >
> > 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:
> >
> > --- 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
> >
> >  # Flags
> > -CFLAGS =3D -std=3Dc89 -pedantic -O2
> > +CFLAGS =3D -std=3Dc89 -pedantic -O2 `pkg-config --cflags --libs =
x11`
> >
> >  SRC =3D main.c
> >  OBJ =3D $(SRC:.c=3D.o)
> >
> > 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.
> >
> > I'd think cmake might be a better option since it's easier to =
maintain in the long run.
> >
> > 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?
>=20
> 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.
>=20
> 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.
>=20
> # Adam
>=20
>=20
> --
> Adam Weinberger
> adamw@adamw.org
> https://www.adamw.org
>=20
>=20




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?52C2A6E6-F4CE-4A2C-A6D0-153FC71250C0>