msantos / procket

Erlang interface to low level socket operations
http://blog.listincomprehension.com/search/label/procket
BSD 3-Clause "New" or "Revised" License
283 stars 80 forks source link

Add support for crosscompiling procket.so #40

Closed fhunleth closed 6 years ago

fhunleth commented 6 years ago

When crosscompiling, this change skips the code that interrogates the host for compilation options. Since it isn't easy to detect the right options for the crosscompile case, the Makefile expects the user to have defined $(CC), $(ERTS_INCLUDE_DIR), $(ERL_INTERFACE_INCLUDE_DIR) and several other variables. Luckily, this is done automatically by at least a couple build systems that are aware of crosscompiling Erlang projects.

The existing code almost worked for the crosscompile case except for wordsize detection. This change skips this and all of the detection logic to avoid any chance of intermingling target and host options.

Crosscompile detection is done by looking for the $(CROSSCOMPILE) variable since it is usually set as well when crosscompiling.

This change was verified by compiling and using procket on a Nerves-based project.

msantos commented 6 years ago

Thank you!

fhunleth commented 6 years ago

Thank you for this project! It was surprisingly easy for me to prototype some code that needed raw sockets.