Distribution & Packaging - HaxeFoundation/hashlink GitHub Wiki

In order to package and distribute a HashLink application, you need to the following files (on Windows):

  • hl.exe which can safely be renamed to YourGame.exe
  • libhl.dll for the HL runtime
  • msvcr120.dll (for the later use either Windows/System32 for HL 64 bits or Windows/SysWOW64 for HL 32)
  • yourgame.hl (compiled bytecode) to rename to hlboot.dat so it's automatically executed by hl.exe
  • the .hdll files you are using
    • fmt.hdll for PNG/JPG/ZIP/etc. support
    • ssl.hdll for HTTPs support
    • some others (see below)

Other dependencies:

  • if you are using Heaps you need heaps.dll openal.hdll ui.hdll uv.hdll as well as OpenAL32.dll (from OpenAL Soft)
  • if you are using SDL support (-lib hlsdl) you need sdl.hdll and SDL2.dll
  • if you are using DirectX support (-lib hldx) you need directx.hdll and d3dcompiler_47.dll (version 6.3, since version 10.x that comes with Windows 10 also requires Universal CRT)
  • if you are using Steam support you need steam.hdll steam_api.dll (from steamworks sdk) and msvcp120.dll (see remarks regarding msvcr120)

You can change the exe icon using rcedit with the following command rcedit YourGame.exe --set-icon myicon.ico

Linux

You'll need a Linux build machine (can be a VM) to build hashlink and related binaries.

Use the following command to fix all binaries in the current folder:

chmod +x *.so* && find *.hdll hl *.so *.so.* | xargs -L 1 patchelf --set-rpath ./

Use the following command to find missing dependencies in the current folder:

ldd * | grep ":\| => " | tr -s " " | cut -d"(" -f1

Mac

You'll need a Mac build machine (can be a VM) to build hashlink and related binaries.

Use the following command to fix all binaries in the current folder:

ls *.hdll *.dylib hl | xargs -L 1 install_name_tool -change libhl.dylib @rpath/libhl.dylib
ls *.hdll *.dylib hl | xargs -I{} sh -c 'otool -l {} | grep " name " | tail -n +2 | tr -s " " | cut -d " " -f3 | grep -v -e "/usr/lib" -e "/System/Library" -e "libhl.dylib" -e "\@loader_path" -e "\@rpath" | sed -E "s/^(\/.*\/)(.*)$$/\1\2 \@rpath\/\2 {}/g"' > tmpargs.txt
cat tmpargs.txt | xargs -L1 echo "install_name_tool -change" > tmpargs2.txt
cat tmpargs2.txt && bash tmpargs2.txt && rm tmpargs.txt tmpargs2.txt

Use the following command to find missing dependencies in the current folder:

ls *.hdll *.dylib hl | xargs -I {} sh -c 'otool -l {} | grep " name " | tail -n +2 | tr -s " " | cut -d " " -f3 | grep -v -e "/usr/lib" -e "/System/Library" -e "libhl.dylib"' || true