On 2023/07/03 18:19:39 +0100, Julian Smith <[email protected]> wrote: > I've made a first attempt at a port for the editor nedit-ng, a > re-implementation of nedit using Qt instead of motif. > > The port is available at: http://op59.net/nedit-ng.tgz > > The website for nedit-ng is: https://github.com/eteran/nedit-ng > > For now the port uses placeholder version 2023.1rc1, and a hard-coded > git sha. I'm expecting to update things to use a new release from the > maintainer soon. > > The port Makefile is just 25 lines and there are no patches. > > > ---- > > > I ran into a few minor issues while making the port: > > * I had to get the following patch pushed to the project's > import/CMakeLists.txt: > > if(${X11_FOUND}) > if(TARGET_PLATFORM_MACOS) > link_directories(/usr/X11/lib) > link_directories(/opt/X11/lib) > endif() > + if(TARGET_PLATFORM_OPENBSD) > + link_directories(/usr/X11R6/lib) > + endif() > endif() > > Is there a better way of doing this - for example does cmake on OpenBSD > already know where to find X11 libraries?
probably setting LDFLAGS=-L${X11BASE}/lib in the environment
> * Could /usr/ports/infrastructure/templates/Makefile.template's
> CONFIGURE_STYLE section mention cmake?
CONFIGURE_STYLE=cmake is something that's set by the cmake.port.mk
module; it's documented in ports-modules(5).
Usually you don't set nor change it, using MODULES=devel/cmake will
automatically set up what's needed for a "standard" cmake project.
> * Issues in https://www.openbsd.org/faq/ports/guide.html:
>
> 5. Fill in DISTNAME
>
> * It wasn't initially clear to me that this must end in a numeric
> version number conforming to packages-specs(7).
>
> This would have been useful because getting this wrong caused
> obscure errors much later from `make package`, saying:
>
> pkg_create: Can't call method "p" on an undefined value
> *** Error 1 in . (/usr/ports/infrastructure/mk/bsd.port.mk:2140
> '/usr/ports/packages/amd64/all/nedit-ng-a5be3d1e.tgz': @trap
> "cd /usr/ports/...) *** Error 2 in .
> (/usr/ports/infrastructure/mk/bsd.port.mk:2621
> '_internal-package': @case X${_DEPENDS_CACHE} in X)
> _DEPENDS_CACHE=$( mktem...) *** Error 2 in
> /usr/ports/editors/nedit-ng
> (/usr/ports/infrastructure/mk/bsd.port.mk:2600 'package':
> @lock=nedit-ng-a5be3d1e; export _LOCKS...)
agreed that's not the best error ever but this is actually documented.
It's very, very subtle, but PKGNAME defaults to DISTNAME, and
FULLPKGNAME (the "real" package name) is based on PKGNAME (plus
eventual flavor, EPOCH and REVISION).
There are cases where DISTNAME doesn't conform to packages-specs, but
as long as it is "unique enough" and PKGNAME is set this is fine. For
simpler cases however, it's best to avoid setting both DISTNAME and
PKGNAME and just use a DISTNAME that makes pkg_create happy.
> 13. Try setting SEPARATE_BUILD.
>
> * How does one do this?
already handled by cmake.port.mk and documented in ports-modules.
that is, it's set by default for cmake ports (my understanding is that
cmake actually requires this)
> 17. Put a longer description of the port into pkg/DESCR
>
> * I think this is required; perhaps that should have been obvious,
> but i got this wrong at first.
yep, it is required. pkg/PLIST and pkg/DESCR are mandatory.
> 22. Create pkg/PLIST
>
> * `make update-plist` failed with `DON'T BUILD PORTS AS ROOT!!!!!`.
> Most of the other `make` commands needed to be run as root, so it
> might be good to clarify this.
the last bit is not correct. see PORTS_PRIVSEP in bsd.port.mk(5) on
how to run the ports command as unpriviledge user.
now, some comments regarding the port itself; some are cosmetic, some
don't
- I'd keep DISTNAME after GH_COMMIT so when you'll switch to
GH_TAGNAME the diff is slightly smaller
- HOMEPAGE is set by default to github when you use the GH_* vars
- USE_GMAKE is not needed, the cmake.port.mk takes care of adding the
needed build depends for itself. (and in particular it uses ninja
instead of make, don't know the reason.)
- as noted previously, CONFIGURE_STYLE is not needed either.
- I'd format the MODULES and BUILD_DEPENDS in multiple lines, as it's
custom
- I've added a COMPILER line since this ports needs C++ (some arches
have g++ in base and that's too old)
- it tries to use git at configure-time to extract the version,
neuter it.
here's a diff against your makefile and an updated tarball attached.
I've just briefly tried the port, the gui pops up and i can type
things. Seems to work for me :-)
notice that this uses devel/boost at build-time "headers-only" but
doesn't link to it. except for this that I'm not sure how to handle,
the port looks OK to me.
--- Makefile.orig Tue Jul 4 10:22:57 2023
+++ Makefile Tue Jul 4 10:39:15 2023
@@ -1,12 +1,11 @@
COMMENT = fast, compact Qt-based plain text editor
-DISTNAME = nedit-ng-2023.1rc1
GH_ACCOUNT = eteran
GH_PROJECT = nedit-ng
GH_COMMIT = a5be3d1e1e0b8dc35015974c2699a59490b17983
+DISTNAME = nedit-ng-2023.1rc1
CATEGORIES = editors
-HOMEPAGE = https://github.com/eteran/nedit-ng
MAINTAINER = Julian Smith <[email protected]>
# GPL-2.0 license
@@ -17,9 +16,14 @@
WANTLIB += Qt5PrintSupport Qt5Widgets Qt5Xml
WANTLIB += X11 c m
-MODULES = devel/cmake x11/qt5
-BUILD_DEPENDS = devel/boost devel/bison
-USE_GMAKE = Yes
-CONFIGURE_STYLE = cmake
+COMPILER = base-clang ports-gcc
+
+MODULES = devel/cmake \
+ x11/qt5
+
+BUILD_DEPENDS = devel/bison \
+ devel/boost
+
+CONFIGURE_ARGS += -DCMAKE_DISABLE_FIND_PACKAGE_Git=TRUE
.include <bsd.port.mk>
nedit-ng.tar.gz
Description: GNU Zip compressed data
