[m-users.] Simple cross-platform GUI

Peter Wang novalazy at gmail.com
Sat Sep 24 12:49:37 AEST 2022


On Fri, 23 Sep 2022 18:26:22 +0200 Dirk Ziegemeyer <dirk at ziegemeyer.de> wrote:
> 
> > Am 20.09.2022 um 03:32 schrieb Peter Wang <novalazy at gmail.com>:
> > 
> >> As all of the above bindings seem to be inactive, I'm wondering if there is any other solution. Is there any simple cross-platform socket or http-server binding for Mercury?
> > 
> > httpsrv does what it was designed to do, so there hasn't been any need
> > to update it.
> 
> Thanks Peter for providing https://github.com/yeslogic/httpsrv.
> Testing on MacOS was successful.
> 
> Installing the dependencies with the Homebrew package manager was as easy as
>     $ brew install libuv http-parser
> 
> There was an issue with librt, which seems neither to exist nor to be required on Mac. Changing the file https://github.com/yeslogic/httpsrv/blob/master/sample/Mercury.options fixed this:
> 
>     - MLLIBS-httpsrv_test += -luv -lhttp_parser -lrt
>     + MLLIBS-httpsrv_test += -luv -lhttp_parser
> 
> Is it possible to automatically skip '-lrt‘ in the Mercury.options file depending on the compilation target? I'm planning to cross-compile from a MacOS host to a Windows target.

Hi Dirk,

I've removed -lrt as it's not required on my Linux machine either (now).

The required libraries will still vary by platform, in particular
Windows. For the sample application, I've just asked the user to run
"make WINDOWS=1". (When cross-compiling, there is the extra complication
that your package manager probably won't provide libuv and http-parser
libraries built for the target platform.)

The way I have used httpsrv is to build its modules as part of the
Mercury application. The src/httpsrv.options file can be included into
the application's Mercury.options file to set compile flags.
Linking with the correct libraries for each platform will need to be
set up by your application's build system.

Peter


More information about the users mailing list