Bug 293507

Summary: [new port] emulators/einstein-newton: Apple Newton Emulator
Product: Ports & Packages Reporter: Laurent Chardon <laurent.chardon>
Component: Individual Port(s)Assignee: Laurent Chardon <laurent>
Status: Closed FIXED    
Severity: Affects Only Me CC: diizzy, laurent, thierry
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   
URL: https://github.com/pguyot/Einstein
See Also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=283342
Attachments:
Description Flags
Patch to create new emulators/einstein-newton port
none
Improved patch to create new emulators/einstein-newton port
none
Improved patch to create new emulators/einstein-newton port - rev 3
none
Improved patch to create new emulators/einstein-newton port - rev4
none
0001-emulators-hatari-Update-to-2.5.0.patch v5
none
Improved patch to create new emulators/einstein-newton port - rev5
none
Improved patch to create new emulators/einstein-newton port - rev6 laurent: maintainer-approval+

Description Laurent Chardon 2026-02-28 19:39:33 UTC
Created attachment 268424 [details]
Patch to create new emulators/einstein-newton port

Port of the Einstein Apple Newton Messagepad emulator to FreeBSD
This port uses its own bundled fltk library while x11-toolkits/fltk is not update (See bug #283342). The bundled library is static only and only used during build.

The patches in files/ will be offered upstream.

portlint:   OK
portclippy: OK
poudriere:  OK
Comment 1 Daniel Engberg freebsd_committer freebsd_triage 2026-03-17 18:11:13 UTC
Any reason to why (lib)ffi being searched for by using it's pkgconfig file (.pc)?

You might also want to have a look at EXTRACT_AFTER_ARGS to avoid extraction and potential inclusion of bundled libraries.
Example: https://cgit.freebsd.org/ports/tree/math/libxlsxwriter/Makefile#n22

Best regards,
Daniel
Comment 2 Daniel Engberg freebsd_committer freebsd_triage 2026-03-17 22:41:58 UTC
Sorry, I meant is not being... Just look for the .pc file?
Comment 3 Laurent Chardon freebsd_committer freebsd_triage 2026-03-22 08:47:59 UTC
(In reply to Daniel Engberg from comment #1)


Thanks for the review!

I didn't know about EXTRACT_AFTER_ARGS, and it's not documented in the porter's guide, but I'll keep it in mind as it seems like a useful tool. In this port however, I do want the bundled libraries. One is part of the emulator, and the other one is bundling the proper dependency version of fltk as documented in the initial PR description: "This port uses its own bundled fltk library while x11-toolkits/fltk is not update[d] (See bug #283342). The bundled library is static only and only used during build."

For libffi, I'm not sure what you mean. The method of finding libffi is implemented by the upstreams developers, if that's what you meant.
Comment 4 Daniel Engberg freebsd_committer freebsd_triage 2026-03-22 08:57:46 UTC
(In reply to Laurent Chardon from comment #3)
Hi,

Since we're already hacking (patching) to find libffi why not make it much easier for all parties?

As for libraries I was mainly thinking of libffi and pulseaudio

Best regards,
Daniel
Comment 5 Laurent Chardon freebsd_committer freebsd_triage 2026-04-03 17:47:06 UTC
Hi,

Good point for the libraries. I'll upload a new patch to remove the libffi and portaudio from the source tree.

For the pkgconfig suggestion, I prefer not to change this in the port. The current library detection logic comes from upstream, and replacing it locally with a pkg-config/.pc based lookup would create a FreeBSD-specific divergence for no clear functional gain. Also, I'm not set-up to check the impact of library detection changes in the other BSDs.
Comment 6 Laurent Chardon freebsd_committer freebsd_triage 2026-04-03 17:49:19 UTC
Created attachment 269346 [details]
Improved patch to create new emulators/einstein-newton port
Comment 7 Daniel Engberg freebsd_committer freebsd_triage 2026-04-05 13:21:46 UTC
+CMAKE_ARGS=	-DCMAKE_BUILD_TYPE=Release \
+		-DEINSTEIN_FETCH_GTEST=OFF
Remove -DCMAKE_BUILD_TYPE=Release (already set by framework) and conflicts with other features such as WITH_DEBUG :)

-DEINSTEIN_FETCH_GTEST=OFF --> CMAKE_OFF= EINSTEIN_FETCH_GTEST

I would poke upstream about using .pc/pkgconfig files for libffi :-)

Best regards,
Daniel
Comment 8 Laurent Chardon freebsd_committer freebsd_triage 2026-04-06 16:25:35 UTC
Created attachment 269417 [details]
Improved patch to create new emulators/einstein-newton port - rev 3
Comment 9 Laurent Chardon freebsd_committer freebsd_triage 2026-04-06 16:27:18 UTC
(In reply to Daniel Engberg from comment #7)

Changes done.

I sent a pull request upstream back in February. I'll keep engaging them for improvements. 

Thanks!
Comment 10 Laurent Chardon freebsd_committer freebsd_triage 2026-04-06 17:11:12 UTC
Created attachment 269419 [details]
Improved patch to create new emulators/einstein-newton port - rev4
Comment 11 Daniel Engberg freebsd_committer freebsd_triage 2026-04-06 19:09:38 UTC
Nitpick but ${WRKDIR}/.build --> ${BUILD_WRKSRC}

Looks good otherwise

In general I'm not too fond of
${RLN} ${WRKSRC_fltk}  ${WRKDIR}/.build/_deps/fltk-src and
${RLN} ${WRKSRC_newt64} ${WRKDIR}/.build/_deps/newt64-src
but having a quick look I don't see any logic moving these over to BUILD_WRKSRC in upstream project file so I'm going to assume its in the FetchContent_* helper(s).
Comment 12 Laurent Chardon freebsd_committer freebsd_triage 2026-04-06 19:12:27 UTC
(In reply to Daniel Engberg from comment #11)

I introduced some regressions in the last patch and the port no longer builds in poudriere. I'll fix that and add your "nitpick" correction.

I also tried to find better ways than linking in ${WRKDIR}/.build/_deps but couldn't find one. 

Thanks!
Comment 13 Laurent Chardon freebsd_committer freebsd_triage 2026-04-07 02:09:10 UTC
Created attachment 269440 [details]
0001-emulators-hatari-Update-to-2.5.0.patch v5
Comment 14 Laurent Chardon freebsd_committer freebsd_triage 2026-04-07 02:17:22 UTC
Created attachment 269441 [details]
Improved patch to create new emulators/einstein-newton port - rev5
Comment 15 Thierry Thomas freebsd_committer freebsd_triage 2026-04-10 16:07:27 UTC
First question: isn't it possible to use the external FLTK provided by x11-toolkits/fltk?

Same questions for JPEG, PNG and ZLIB.

And several external ports are detected by configure, although they are not registered as dependencies: this is bad for reproducible builds.

-- Found PkgConfig: /usr/local/bin/pkg-config (found version "2.4.3")

-- Found Doxygen: /usr/local/bin/doxygen (found version "1.9.6") found components: doxygen dot
-- Found LATEX: /usr/local/bin/latex

-- Checking for module 'xkbcommon'
--   Found xkbcommon, version 1.13.1

-- Checking for module 'cairo'
--   Found cairo, version 1.18.2
-- Checking for module 'pangoxft'
--   Found pangoxft, version 1.56.4
-- Checking for module 'pangocairo'
--   Found pangocairo, version 1.56.4
-- Checking for module 'dbus-1'
--   Found dbus-1, version 1.16.2

-- Bundled Libraries        JPEG     = Bundled
--                          PNG      = Bundled
--                          ZLIB     = Bundled
--                          Libdecor = System: /usr/local/lib/libdecor-0.so
-- Use DBUS                 Yes

Then after the build, quality-check reports:

Error: /usr/local/bin/Einstein is linked to /usr/local/lib/libpango-1.0.so.0 from x11-toolkits/pango but it is not declared as a dependency
Warning: you need USE_GNOME+=pango
Error: /usr/local/bin/Einstein is linked to /usr/local/lib/libpangocairo-1.0.so.0 from x11-toolkits/pango but it is not declared as a dependency
Warning: you need USE_GNOME+=pango
Error: /usr/local/bin/Einstein is linked to /usr/local/lib/libcairo.so.2 from graphics/cairo but it is not declared as a dependency
Warning: you need USE_GNOME+=cairo
Error: /usr/local/bin/Einstein is linked to /usr/local/lib/libharfbuzz.so.0 from print/harfbuzz but it is not declared as a dependency
Warning: you need LIB_DEPENDS+=libharfbuzz.so:print/harfbuzz
Error: /usr/local/bin/Einstein is linked to /usr/local/lib/libgobject-2.0.so.0 from devel/glib20 but it is not declared as a dependency
Warning: you need USE_GNOME+=glib20
Error: /usr/local/bin/Einstein is linked to /usr/local/lib/libglib-2.0.so.0 from devel/glib20 but it is not declared as a dependency
Warning: you need USE_GNOME+=glib20
Error: /usr/local/bin/Einstein is linked to /usr/local/lib/libintl.so.8 from devel/gettext-runtime but it is not declared as a dependency
Warning: you need USES+=gettext-runtime
Error: /usr/local/bin/Einstein is linked to /usr/local/lib/libpangoxft-1.0.so.0 from x11-toolkits/pango but it is not declared as a dependency
Warning: you need USE_GNOME+=pango
Error: /usr/local/bin/Einstein is linked to /usr/local/lib/libpangoft2-1.0.so.0 from x11-toolkits/pango but it is not declared as a dependency
Warning: you need USE_GNOME+=pango
Error: /usr/local/bin/Einstein is linked to /usr/local/lib/libfreetype.so.6 from print/freetype2 but it is not declared as a dependency
Warning: you need LIB_DEPENDS+=libfreetype.so:print/freetype2
Error: /usr/local/bin/Einstein is linked to /usr/local/lib/libdecor-0.so.0 from x11-toolkits/libdecor but it is not declared as a dependency
Warning: you need LIB_DEPENDS+=libdecor-0.so:x11-toolkits/libdecor
Error: /usr/local/bin/Einstein is linked to /usr/local/lib/libwayland-cursor.so.0 from graphics/wayland but it is not declared as a dependency
Warning: you need LIB_DEPENDS+=libwayland-cursor.so:graphics/wayland
Error: /usr/local/bin/Einstein is linked to /usr/local/lib/libwayland-client.so.0 from graphics/wayland but it is not declared as a dependency
Warning: you need LIB_DEPENDS+=libwayland-client.so:graphics/wayland
Error: /usr/local/bin/Einstein is linked to /usr/local/lib/libxkbcommon.so.0 from x11/libxkbcommon but it is not declared as a dependency
Warning: you need LIB_DEPENDS+=libxkbcommon.so:x11/libxkbcommon
Error: /usr/local/bin/Einstein is linked to /usr/local/lib/libdbus-1.so.3 from devel/dbus but it is not declared as a dependency
Warning: you need LIB_DEPENDS+=libdbus-1.so:devel/dbus
Comment 16 Laurent Chardon freebsd_committer freebsd_triage 2026-04-14 12:05:21 UTC
(In reply to Thierry Thomas from comment #15)

The port has a requirement for fltk 1.4.0 or higher, and currently the ports tree has fltk 1.3.10. That's why I compile fltk 1.4.4 with the port using the upstream recipe, which also compiles its own dependencies. I can undo that once bug #283342 is solved. I'd rather not wait after this PR, because it's been opened since December 2024.

The unwanted configure detections also come from the bundled fltk. I fixed that and will upload a new patch shortly.
Comment 17 Laurent Chardon freebsd_committer freebsd_triage 2026-04-14 15:43:53 UTC
Created attachment 269770 [details]
Improved patch to create new emulators/einstein-newton port - rev6
Comment 18 Thierry Thomas freebsd_committer freebsd_triage 2026-04-14 19:54:29 UTC
Approved, thanks!

(don't forget emulators/Makefile)
Comment 19 Daniel Engberg freebsd_committer freebsd_triage 2026-04-15 03:35:00 UTC
CMAKE_ARGS should be converted to CMAKE_ON and CMAKE_OFF for allmost all calls.

You should be able to use cmake:testing if you set ALL_TARGET to all EinsteinTests when test is called.

I would argue that we should fix the fltk port before landing this as it appears to have stalled with current submitter.
Comment 20 Laurent Chardon freebsd_committer freebsd_triage 2026-04-15 20:36:14 UTC
Thank you both for your reviews!
Comment 21 commit-hook freebsd_committer freebsd_triage 2026-04-15 20:41:06 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=0e53c9054836194d1740ba0af1005b6881b17e80

commit 0e53c9054836194d1740ba0af1005b6881b17e80
Author:     Laurent Chardon <laurent@FreeBSD.org>
AuthorDate: 2026-04-03 14:42:10 +0000
Commit:     Laurent Chardon <laurent@FreeBSD.org>
CommitDate: 2026-04-15 20:40:01 +0000

    emulators/einstein-newton: Add new port

    PR:             293507
    Reviewed by:    thierry (mentor), diizy
    Approved by:    thierry (mentor)

 emulators/Makefile                                 |   1 +
 emulators/einstein-newton/Makefile (new)           |  75 +++++
 emulators/einstein-newton/distinfo (new)           |   7 +
 .../files/patch-CMakeLists.txt (new)               | 369 +++++++++++++++++++++
 ...patch-Emulator_NativeCalls_CMakeLists.txt (new) |  11 +
 .../patch-Emulator_Serial_CMakeLists.txt (new)     |  11 +
 .../patch-Emulator_Sound_CMakeLists.txt (new)      |  11 +
 .../files/patch-newt64-src_CMakeLists.txt (new)    |  81 +++++
 emulators/einstein-newton/pkg-descr (new)          |   3 +
 9 files changed, 569 insertions(+)