From owner-freebsd-ports@freebsd.org Sat Nov 25 04:02:20 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 2E9C8DFE065 for ; Sat, 25 Nov 2017 04:02:20 +0000 (UTC) (envelope-from gurenchan@gmail.com) Received: from mail-io0-x232.google.com (mail-io0-x232.google.com [IPv6:2607:f8b0:4001:c06::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E6937725C9 for ; Sat, 25 Nov 2017 04:02:19 +0000 (UTC) (envelope-from gurenchan@gmail.com) Received: by mail-io0-x232.google.com with SMTP id 79so23680184ioi.3 for ; Fri, 24 Nov 2017 20:02:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=+GwJxDIMJgXa1m4ZeSc+KPAb3oJN8e9N9cd3sOksQ+o=; b=LlcnGfOE0LVgWv4OcWLqymZwgkgz9SumMrD+Q6n9w9uIxUFUpzdKYldXIwxy1KyxbH 9V1sWN9x1WeQHVqg4eEp7tBplVTWWIKBryBgYfnui2zhzdXjmFrR+GC7jNzC3KLi9Csw pi2/jtnBIAh+UDKG/5Vj0LYXuT/flKUiWGsO/vMnaV643kIeiCfgAu/uUyuSb+ijipVw Pk9ad4bs802QGm3T7RnjQJfpqvFZtWQdo03wPnY71vZDcAZvY1JteQREcQTr1rVkMljb pQYIpHoIMMMlRvlnOt528Dr/lOg8euJhsWX9eYQNJnW5apeKiEZOeoH3zH0pwrqJ+MmH ky8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=+GwJxDIMJgXa1m4ZeSc+KPAb3oJN8e9N9cd3sOksQ+o=; b=IBmxsdss6lKZoPULwlhJ85LB1BjWprfVJ9dsBo50l4eziKU+J26dX45ZyrwOBk227b lDudbrMvbf2h/RTOD54QKNiKsVrt4AUC+vauL7WR3unio+4QdNX0Jr+1vG2C8BlINqGY 0dHIaZsgwgBRKVePbgV+wyuOfQM7ytRZZs1Kl3M/hBIogP4fP4xwnRvxLPSoKye2mr7x dAuNpGHGrrftcr16/cEDjtrs+PrR/CngubErkVsPWLx+//sAoGkTrvvD9z8frWoog5A2 4hDlpPnwWpbQkhIxvg7EiLye/7Oodhw03LVfCLVP0qUvoqtFSq4+h0hD+okCHv63ACWd ItFg== X-Gm-Message-State: AJaThX4QolxtyNiPSgEjZnMz9txDxkv8aLtgIK31oPyRqGTn4tZz0eCL SNhnDR/6Rg4MKqC7rae5XmLXxmG7OH/XeJ3h+H2S7w== X-Google-Smtp-Source: AGs4zMaEksMie0gR4EI3idkB5WPCdmwwnZrTDkCpdsirdyBnQSBshfk+fjD4xr1x9Nadzp7gD9Y6RXQtOqpxxxBEAD8= X-Received: by 10.107.135.97 with SMTP id j94mr2256263iod.213.1511582539199; Fri, 24 Nov 2017 20:02:19 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.11.31 with HTTP; Fri, 24 Nov 2017 20:02:18 -0800 (PST) In-Reply-To: <0F82F594-2D9B-48A2-99B0-909A6105D96D@adamw.org> References: <90470926-1E50-4CD9-A797-9D013B9B68D5@adamw.org> <0F82F594-2D9B-48A2-99B0-909A6105D96D@adamw.org> From: blubee blubeeme Date: Sat, 25 Nov 2017 12:02:18 +0800 Message-ID: Subject: Re: a project with custom makefile To: Adam Weinberger Cc: FreeBSD Ports Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 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 04:02:20 -0000 the x11 was just the first example, there's a total of about 15 different projects OPTIONS_DEFINE= x11 x11_rawfb x11_gl2 x11_gl3 \ allegro5 gdi gdip glfw2 glfw3 \ sdl_gl2 sdl_gl3 sdl_gles2 \ sfml_gl2 sfml_gl3 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. On Sat, Nov 25, 2017 at 11:57 AM, Adam Weinberger wrote: > > On 24 Nov, 2017, at 20:42, blubee blubeeme 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= x11 > > > > x11_DESC= Nuklear X11 Demo > > > > USE_GITHUB= yes > > GH_ACCOUNT= vurtun > > GH_TAGNAME= 36a396f > > > > .include > > do-build: > > .if ${PORT_OPTIONS:Mx11} > > @(${DO_MAKE_BUILD} -C ${WRKSRC}/demo/x11/) > > .endif > > .include > > > > 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 = zahnrad > > +BIN = x11-zahnrad > > > > # Flags > > -CFLAGS = -std=c89 -pedantic -O2 > > +CFLAGS = -std=c89 -pedantic -O2 `pkg-config --cflags --libs x11` > > > > SRC = main.c > > OBJ = $(SRC:.c=.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? > > 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 > > > -- > Adam Weinberger > adamw@adamw.org > https://www.adamw.org > >