Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lua: Make building more generic (build for any arch) #81

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Darchiv
Copy link
Member

@Darchiv Darchiv commented Jul 5, 2024

Default version changed from 5.3.5 to 5.3.6.

Added port build options:

  • PORTS_LUA_VERSION - version to download (must be supported by respective patches);
  • PORTS_LUA_STACK_SIZE - size of Lua's internal stack;
  • PORTS_LUA_CSTACK_SIZE - size of stack (when using linked lua binary);
  • PORTS_LUA_COMPAT_5_2 - backward compatibility with Lua 5.2;
  • PORTS_LUA_DEBUG - enable debug features, e.g. API checks;
  • PORTS_LUA_INSTALL_TESTS - download and install external Lua test scripts;
  • PORTS_LUA_RESTRAIN - disable Lua features which may be used to crash the interpreter or perform side-effects in the operating system.

JIRA: NIL-595

Description

Motivation and Context

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Chore (refactoring, style fixes, git/CI config, submodule management, no code logic changes)

How Has This Been Tested?

  • Already covered by automatic testing.
  • New test added: (add PR link here).
  • Tested by hand on: imxrt1170.

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing linter checks and tests passed.
  • My changes generate no new compilation warnings for any of the targets.

Special treatment

Default version changed from 5.3.5 to 5.3.6.

Added port build options:
 - PORTS_LUA_VERSION - version to download (must be supported by
   respective patches);
 - PORTS_LUA_STACK_SIZE - size of Lua's internal stack;
 - PORTS_LUA_CSTACK_SIZE - size of stack (when using linked lua binary);
 - PORTS_LUA_COMPAT_5_2 - backward compatibility with Lua 5.2;
 - PORTS_LUA_DEBUG - enable debug features, e.g. API checks;
 - PORTS_LUA_INSTALL_TESTS - download and install external Lua test
   scripts;
 - PORTS_LUA_RESTRAIN - disable Lua features which may be used to crash
   the interpreter or perform side-effects in the operating system.

JIRA: NIL-595
fi

mycflags=(
${CFLAGS}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [shellcheck] reported by reviewdog 🐶
Quote to prevent word splitting/globbing, or split robustly with mapfile or read -a. SC2206

fi

mycflags=(
${CFLAGS}
-DLUAI_MAXSTACK=${PORTS_LUA_STACK_SIZE:-2000}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [shellcheck] reported by reviewdog 🐶
Quote to prevent word splitting/globbing, or split robustly with mapfile or read -a. SC2206

if [ "${PORTS_LUA_COMPAT_5_2}" = "y" ]; then mycflags+=("-DLUA_COMPAT_5_2"); fi
if [ "${PORTS_LUA_DEBUG}" = "y" ]; then mycflags+=("-DLUA_USE_APICHECK"); fi

myldflags=(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [shellcheck] reported by reviewdog 🐶
Use spaces, not commas, to separate array elements. SC2054

if [ "${PORTS_LUA_DEBUG}" = "y" ]; then mycflags+=("-DLUA_USE_APICHECK"); fi

myldflags=(
${LDFLAGS}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [shellcheck] reported by reviewdog 🐶
Quote to prevent word splitting/globbing, or split robustly with mapfile or read -a. SC2206


myldflags=(
${LDFLAGS}
-Wl,-z,stack-size=${PORTS_LUA_CSTACK_SIZE:-4096}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [shellcheck] reported by reviewdog 🐶
Quote to prevent word splitting/globbing, or split robustly with mapfile or read -a. SC2206

fi

mycflags=(
${CFLAGS}
-DLUAI_MAXSTACK=${PORTS_LUA_STACK_SIZE:-2000}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LUAI_MAXSTACK passed to lualib should be compatible with the one that is given to applications (as it is used in one of the header files of Lua API). The value of PORTS_LUA_STACK_SIZE will be used outside of ports too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants