# --- T2-COPYRIGHT-NOTE-BEGIN --- # T2 SDE: package/*/lua/lua.conf # Copyright (C) 2004 - 2023 The T2 SDE Project # # This Copyright note is generated by scripts/Create-CopyPatch, # more information can be found in the files COPYING and README. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2. # --- T2-COPYRIGHT-NOTE-END --- # inherit variables like myCFLAGS, myLIBS . $base/package/*/*/lua-conf.in # latest, official Lua patch, unfortunatly unversioned and not -p1 :-( lpatch="`match_source_file -p .patch`" if [ "$lpatch" ]; then hook_add prepatch 5 "(cd src; patch -p0 < $lpatch)" fi # adjust installation path var_append makeopt ' ' "INSTALL_TOP=/$prefix INSTALL_LIB=$libdir" var_append makeinstopt ' ' "INSTALL_TOP=$root/$prefix INSTALL_LIB=$root$libdir" # guess aix bsd c89 freebsd linux-readline mingw posix solaris case $SDECFG_KERNEL in linux) var_append makeopt ' ' 'linux' ;; darwin) var_append makeopt ' ' 'macosx' ;; *) var_append makeopt ' ' 'generic' ;; esac # configure: # -enable dynamic module loading # -enable CLI with readline var_append makeopt ' ' "MYCFLAGS=\"$myCFLAGS\"" #[ $SDECFG_KERNEL = linux ] && var_insert myLIBS ' ' '-Wl,-E' var_append makeopt ' ' "MYLIBS=\"$myLIBS\"" # adjust luaconf.h header lua_conf() { if ! atstage toolchain; then LUA_ROOT="/$prefix" else LUA_ROOT="$root/$prefix" fi sed -i "s,^#define LUA_ROOT.*,#define LUA_ROOT \"$LUA_ROOT/\"," src/luaconf.h sed -i "s,^\(#define LUA_CDIR.*\)lib\(/.*\),\1${libdir##*/}\2," src/luaconf.h } hook_add premake 3 lua_conf # create a lua-config script lua_config_postmake() { sde_substitute $confdir/lua-config | sed -e "s,@LIBS@,$myLIBS," \ -e "s,@CFLAGS@,$myCFLAGS," \ -e "s,@pkglibdir@,$root$pkglibdir," \ -e "s,@pkgdatadir@,$root$pkgdatadir," \ -e "s,//,/,g" > $root$bindir/lua-config chmod 0755 $root$bindir/lua-config } hook_add postmake 3 lua_config_postmake # create a lua.pc pkgconfig file if pkginstalled pkgconfig; then lua_pc_postmake() { sde_substitute $confdir/lua.pc | sed -e "s,@LIBS@,$myLIBS," \ -e "s,@CFLAGS@,$myCFLAGS," \ -e "s,@pkglibdir@,$root$pkglibdir," \ -e "s,@pkgdatadir@,$root$pkgdatadir," \ -e "s,//,/,g" > $root$libdir/pkgconfig/lua.pc } hook_add postmake 3 lua_pc_postmake fi # create missing directories and copy documentation lua_postmake() { mkdir -p $root$pkglibdir/ mkdir -p $root$pkgdatadir/ mkdir -p $root$docdir cp -v doc/* $root$docdir } hook_add postmake 3 lua_postmake # shared object [ "$SDECFG_STATIC" != 1 ] && var_append patchfiles ' ' "$confdir/shared-object.diff" # cross build var_append AR ' ' rc