unixwork / xnedit

A fast and classic X11 text editor, based on NEdit, with full unicode support and antialiased text rendering.
Other
83 stars 11 forks source link

MacOS support on Ventura with Homebrew #91

Closed dpeterc closed 1 year ago

dpeterc commented 1 year ago

The makefiles for MacOS were made with Fink porting environment. Nowadays Fink is not updated regularly anymore, and it is not possible to use it in newer versions of MacOS like Big Sur, Monterey or Ventura. https://www.finkproject.org The Homebrew project, on the other hand, is much more up to date, and it works correctly on Ventura https://brew.sh

In order to compile xnedit on Homebrew with Ventura (and the latest XQuartz 2.8.3), you need to change the following lines in file Makefiles/Makefile.macosx CFLAGS=-O2 -I/usr/x11/include -I/usr/x11/include/freetype2

CFLAGS=-O2 -I/opt/X11/include -I/opt/X11/include/X11 -I/opt/X11/include/freetype2

LIBS= -lpcre -lXm -lXmu -lXft -lfontconfig -lXt -lX11 -lm -lXpm -lXrender -ljpeg -lpng -liconv

LIBS= -L/opt/X11/lib -lpcre -lXm -lXmu -lXft -lfontconfig -lXt -lX11 -lm -lXpm -lXrender -ljpeg -lpng -liconv

The line with # was the previous contents of the file. By making this change, and typing command make macosx the program compiles and runs correctly. I would also suggest a change in name of the makefile, since macosx indicates version 10 of the macOS (X for 10). Ventura is version 13. Apple is no longer using name MacOSX, but MacOS. So the makefile should be renamed into Makefile.macos

unixwork commented 1 year ago

Ok, I have now access to macOS Ventura. I installed XQuartz and brew. Some of the required headers are in /usr/X11/include. However the libraries installed by brew are in /opt/homebrew and I need to add -I/opt/homebrew/include/ to CFLAGS and -L/opt/homebrew/lib to LIBS.

Are there different ways to install homebrew or is there a difference between intel macs and apple silicon macs?

dpeterc commented 1 year ago

You are right, my initial suggestion is not correct. There are different ways to install homebrew, it is not about difference between Intel and Apple silicon macs. Homebrew can be installed in user's home directory, custom location or default location /opt/homebrew The correct way to get homebrew include and library path is: CFLAGS=-O2 -I/usr/x11/include -I$(brew --prefix)/include -I/usr/x11/include/freetype2 LIBS=-L$(brew --prefix)/lib -lpcre -lXm -lXmu -lXft -lfontconfig -lXt -lX11 -lm -lXpm -lXrender -ljpeg -lpng -liconv