Skip to content

Adding xmake support for ps1-packer.#2053

Merged
nicolasnoble merged 1 commit into
grumpycoders:mainfrom
nicolasnoble:xmake-tools
Jul 13, 2026
Merged

Adding xmake support for ps1-packer.#2053
nicolasnoble merged 1 commit into
grumpycoders:mainfrom
nicolasnoble:xmake-tools

Conversation

@nicolasnoble

Copy link
Copy Markdown
Member

No description provided.

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The changes add Xmake definitions for support libraries and the ps1-packer packaging workflow, while updating history-rewrite rules for third-party and Lua-related files.

Changes

Support build and packaging

Layer / File(s) Summary
Support library targets
src/support/xmake.lua, src/supportpsx/xmake.lua
Adds static library targets with C/C++ standards, package dependencies, include paths, compile definitions, and source-file registration.
ps1-packer packaging rule
tools/ps1-packer/xmake.lua
Configures the packer binary and runs it after linking to produce a configurable output artifact, removing that artifact during clean.

History cleanup

Layer / File(s) Summary
History filter rules
.github/filter-support/filter.sh
Splits third-party cleanup into two filter passes and preserves xmake.lua when removing Lua-related files.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Xmake
  participant ps1_packer
  participant PackedOutput
  Xmake->>ps1_packer: Link executable
  Xmake->>ps1_packer: Pass configured output path
  ps1_packer->>PackedOutput: Generate packed artifact
  Xmake->>PackedOutput: Remove artifact during clean
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive No description was provided, so there is no meaningful summary to assess. Add a brief description of the build-system changes and affected targets.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: adding xmake support for ps1-packer.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
tools/ps1-packer/xmake.lua (1)

39-43: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Verify ps1-packer default load address is sufficient for all targets using this rule.

The after_link function only passes -o to ps1-packer. The shell Makefile (src/mips/shell/Makefile:6) uses -tload 0x80030000 to set a specific load address. While -raw is specific to raw binary output (not PSEXE), the -tload flag may be needed for targets with non-default load addresses. If ps1-packer doesn't read the load address from the ELF headers, the packed PSEXE output could have an incorrect entry point. Consider making additional flags configurable via a target value, similar to how psx.extension is already handled in on_load.

♻️ Suggested approach for configurable flags
     target:add("values", "ps1-packer.psexe.postlink.outfile", outfile)
+    target:add("values", "ps1-packer.psexe.postlink.extra_args", "")
     target:add("values", "psexe", false)
 end)
 after_link(function(target)
     local ps1packer = target:dep("ps1-packer")
     local outfile = target:values("ps1-packer.psexe.postlink.outfile")
-    os.run("%s %s -o %s", ps1packer:targetfile(), target:targetfile(), outfile)
+    local extra_args = target:values("ps1-packer.psexe.postlink.extra_args") or ""
+    os.run("%s %s %s -o %s", ps1packer:targetfile(), extra_args, target:targetfile(), outfile)
 end)

Targets needing a custom load address would then set target:values("ps1-packer.psexe.postlink.extra_args", "-tload 0x80030000") in their own on_load.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tools/ps1-packer/xmake.lua` around lines 39 - 43, Make the arguments used by
the ps1-packer invocation in the after_link hook configurable through a target
value such as ps1-packer.psexe.postlink.extra_args, defaulting to no additional
arguments, and append them alongside the existing -o output option. Preserve
current behavior for targets without extra arguments while allowing targets with
non-default load addresses to supply -tload explicitly.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/filter-support/filter.sh:
- Around line 23-24: Update the second filter-branch tree-filter command to
enumerate third_party submodules from the Git index using git ls-files -s,
selecting mode 160000 entries while preserving the existing exclusions. Remove
each matching gitlink path with git rm -f, rather than relying on find to
discover directories in the worktree; keep the existing tag filtering and
prune-empty options unchanged.

---

Nitpick comments:
In `@tools/ps1-packer/xmake.lua`:
- Around line 39-43: Make the arguments used by the ps1-packer invocation in the
after_link hook configurable through a target value such as
ps1-packer.psexe.postlink.extra_args, defaulting to no additional arguments, and
append them alongside the existing -o output option. Preserve current behavior
for targets without extra arguments while allowing targets with non-default load
addresses to supply -tload explicitly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 97c9f4f0-8e0a-4f42-8995-213ce5d77e34

📥 Commits

Reviewing files that changed from the base of the PR and between 0a7f74f and f1b80d2.

📒 Files selected for processing (4)
  • .github/filter-support/filter.sh
  • src/support/xmake.lua
  • src/supportpsx/xmake.lua
  • tools/ps1-packer/xmake.lua

Comment on lines +23 to +24
git filter-branch -f --tree-filter 'find third_party -maxdepth 1 -type d -and -not -name third_party -and -not -path third_party/cueparser* -and -not -path third_party/ELFIO\* -and -not -path third_party/expected\* -and -not -path third_party/fmt\* -and -not -path third_party/googletest\* -and -not -path third_party/iec-60908b\* -and -not -path third_party/magic_enum\* -and -not -path third_party/PEGTL\* -and -not -path third_party/ucl\* -exec rm -rf {} \; || true' --tag-name-filter cat --prune-empty
git filter-branch -f --tree-filter 'find third_party -maxdepth 1 -type d -and -not -name third_party -and -not -path third_party/cueparser* -and -not -path third_party/ELFIO\* -and -not -path third_party/expected\* -and -not -path third_party/fmt\* -and -not -path third_party/googletest\* -and -not -path third_party/iec-60908b\* -and -not -path third_party/magic_enum\* -and -not -path third_party/PEGTL\* -and -not -path third_party/ucl\* -exec git rm -f {} \; || true' --tag-name-filter cat --prune-empty

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Discover submodules from the index, not the working tree.

Submodules are gitlink entries, and this workflow does not initialize submodules during checkout. Their directories can therefore be absent from the tree-filter worktree, causing find to skip them and leaving unwanted third_party gitlinks in the exported history. Enumerate mode 160000 entries with git ls-files -s (while applying the same exclusions), then remove those paths with git rm -f.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/filter-support/filter.sh around lines 23 - 24, Update the second
filter-branch tree-filter command to enumerate third_party submodules from the
Git index using git ls-files -s, selecting mode 160000 entries while preserving
the existing exclusions. Remove each matching gitlink path with git rm -f,
rather than relying on find to discover directories in the worktree; keep the
existing tag filtering and prune-empty options unchanged.

@nicolasnoble nicolasnoble merged commit 2e7ecc4 into grumpycoders:main Jul 13, 2026
16 of 19 checks passed
@nicolasnoble nicolasnoble deleted the xmake-tools branch July 13, 2026 07:16
@coderabbitai coderabbitai Bot mentioned this pull request Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant