So, looking at the files that the toluapp port installs:
$ port -q contents toluapp | xargs otool -L | grep -v "not an object"
/opt/local/bin/toluapp:
@executable_path/../lib/libtoluapp.dylib (compatibility version 0.0.0, current version 0.0.0)
/opt/local/lib/liblua.dylib (compatibility version 5.1.0, current version 5.1.4)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 169.3.0)
/opt/local/lib/libtoluapp.dylib:
@executable_path/../lib/libtoluapp.dylib (compatibility version 0.0.0, current version 0.0.0)
/opt/local/lib/liblua.dylib (compatibility version 5.1.0, current version 5.1.4)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 169.3.0)
So the libtoluapp.dylib library will work fine when referenced from the toluapp program, or any other program that is at the same relative directory location from the library. But if it is intended that other non-MacPorts software be able to use this library, then yes, you're right, its install_name should be an absolute path instead, as install_names typically are in MacPorts.
I see this port uses cmake, and I don't understand cmake well. But the relevant portion of the build system seems to be this:
$ grep @executable_path -r work/
work/toluapp-1.0.93/cmake/dist.cmake: set ( CMAKE_INSTALL_NAME_DIR @executable_path/${UP_DIR}/${INSTALL_LIB}
This is part of a bigger block:
# RPath and relative linking
option ( USE_RPATH "Use relative linking." ON)
if ( USE_RPATH )
string ( REGEX REPLACE "[^!/]+" ".." UP_DIR ${INSTALL_BIN} )
set ( CMAKE_SKIP_BUILD_RPATH FALSE CACHE STRING "" FORCE )
set ( CMAKE_BUILD_WITH_INSTALL_RPATH FALSE CACHE STRING "" FORCE )
set ( CMAKE_INSTALL_RPATH $ORIGIN/${UP_DIR}/${INSTALL_LIB}
CACHE STRING "" FORCE )
set ( CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE CACHE STRING "" FORCE )
set ( CMAKE_INSTALL_NAME_DIR @executable_path/${UP_DIR}/${INSTALL_LIB}
CACHE STRING "" FORCE )
endif ()
So it appears that if you tell cmake to not "USE_RPATH", then it won't do this undesirable relative path thing that it's doing. I've attached a patch to do this, and verified that it works:
$ port -q contents toluapp | xargs otool -L | grep -v "not an object"
/opt/local/bin/toluapp:
/opt/local/lib/libtoluapp.dylib (compatibility version 0.0.0, current version 0.0.0)
/opt/local/lib/liblua.dylib (compatibility version 5.1.0, current version 5.1.4)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 169.3.0)
/opt/local/lib/libtoluapp.dylib:
/opt/local/lib/libtoluapp.dylib (compatibility version 0.0.0, current version 0.0.0)
/opt/local/lib/liblua.dylib (compatibility version 5.1.0, current version 5.1.4)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 169.3.0)
Look good to you? If so I can commit it.