[Libwebsockets] port to new platform

Andy Green andy at warmcat.com
Mon Aug 20 01:09:40 CEST 2018



On 07/03/2018 05:04 PM, Christian Treff wrote:
> Hi,
> 
> I’m currently trying to port to a new platform, and have some problems 
> in the platform file. Is there any porting guide available? I didn’t 
> find anything in the manual.

Sorry for the delayed response...

The last time someone other than me ported lws to a really new platform 
was windows, many years ago.  So documenting this has not been high on 
the list of things to work on.

Otherwise the new platforms have all been some variation of the existing 
ones, eg, some kind of *nix that just needs some extra #ifs.  The people 
who have done that figured out what was needed from what was there, it 
works already and many of the adaptations for variations are already 
there, it's usually things like libc / toolchain headers with different 
names or in different places.  For example Android is 99%+ already 
supported as "unix" plat.  I think you also will find (have found) that 
manageable.

If what you want(ed...) to do is really a "new platform", the 
platform-specific stuff mainly lives in four places

  - ./lib/plat/...

  - the private.h files (as little as possible...)

  - libwebsockets.h (as little as possible...)

  - CMakeLists.txt / ./cmake lws_config.h.in to enable and disable it 
and make the decision visible to the library code at build-time

If your platform is simple, you can find a "minimal example" for what a 
new platform must export in the OPTEE (trusted OS environment) port, 
which stubs out almost everything.

https://libwebsockets.org/git/libwebsockets/tree/lib/plat/optee/lws-plat-optee.c

Otherwise the "full monty" can be found in

https://libwebsockets.org/git/libwebsockets/tree/lib/plat/unix

The set of lws_plat_...() handlers came about largely to try to support 
the differences between windows and unix cleanly.  If the platform is 
really not posix, nor windows' WSA, more might need to be added which we 
can discuss.

-Andy

> Best regards,
> 
> Christian
> 
> Christian Treff
> 
> Application Engineer
> 
> TenAsys Europe GmbH
> 
> Hans-Stiessberger-Str.2b
> 
> 85540 Haar / Munich
> 
> Germany
> 
> Direct:     +49 (89) 46 1498 46
> 
> Fax:          +49 (89) 46 1498 47
> 
> _christian.treff at tenasys.com 
> <mailto:christian.treff at tenasys.com>_www.tenasys.com 
> <http://www.tenasys.com/>
> 
> Sitz der Gesellschaft / Location: Haar / Muenchen, Handelsregister / 
> Registered: HRB 187939, AG Muenchen
> 
> Steuernummer / Tax Number: 143/185/60987, Umsatzsteuer-ID / VAT-ID: DE 
> 274036146
> 
> Geschaeftsfuehrer / Managing Directors.: Kim Hartman, Christopher Main
> 
> 
> 
> _______________________________________________
> Libwebsockets mailing list
> Libwebsockets at ml.libwebsockets.org
> https://libwebsockets.org/mailman/listinfo/libwebsockets
> 


More information about the Libwebsockets mailing list