Skip to content

Allow overriding compiler used for runtime library builds#56

Open
noafroboy wants to merge 1 commit intoopen64-compiler:developfrom
noafroboy:feature/lib-build-compiler-override
Open

Allow overriding compiler used for runtime library builds#56
noafroboy wants to merge 1 commit intoopen64-compiler:developfrom
noafroboy:feature/lib-build-compiler-override

Conversation

@noafroboy
Copy link

Summary

  • Add LIB_BUILD_COMPILER variable (defaults to SELF) to control which compiler builds the runtime libraries

Motivation

LIB_ARGS and LIB2_ARGS hardcode BUILD_COMPILER=SELF, which means runtime libraries are always built with the freshly-compiled opencc. Command-line overrides like make lib BUILD_COMPILER=GNU are silently ignored because the hardcoded value in the recipe variable takes precedence.

This makes cross-compilation scenarios impossible — if opencc was built for a different architecture than the build host, it cannot be executed to compile the runtime libraries.

The new LIB_BUILD_COMPILER ?= SELF variable preserves the existing default behavior while allowing overrides:

make lib LIB_BUILD_COMPILER=GNU

Changes

  • Makefile.in: Add LIB_BUILD_COMPILER ?= SELF, replace hardcoded BUILD_COMPILER=SELF with BUILD_COMPILER=$(LIB_BUILD_COMPILER) in both LIB_ARGS and LIB2_ARGS

Test plan

  • make lib (no override) — still uses opencc (default SELF behavior)
  • make lib LIB_BUILD_COMPILER=GNU — uses system GCC for runtime libs
  • make lib2 LIB_BUILD_COMPILER=GNU — uses system GCC for 32-bit runtime libs

🤖 Generated with Claude Code

Add LIB_BUILD_COMPILER variable (defaults to SELF) so the compiler
used for runtime library builds can be overridden on the command line:

    make lib LIB_BUILD_COMPILER=GNU

Previously, LIB_ARGS and LIB2_ARGS hardcoded BUILD_COMPILER=SELF,
which meant command-line overrides like 'make lib BUILD_COMPILER=GNU'
were silently ignored (the hardcoded value in the recipe took
precedence over the command-line value).

This is needed for cross-compilation scenarios where the freshly-built
opencc cannot run on the build host (e.g. building x86_64 Open64 on a
non-x86_64 machine via emulation).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant