Skip to content

Commit

Permalink
Modernize MakeROM build system + bug fixes (#120)
Browse files Browse the repository at this point in the history
* Move files around to new directory structure

* Rework libyaml into a stand-alone dep for makerom.

* Rework libpolarssl to be standalone dependency for makerom.

* Update includes.

* Delete makefile

* Add new makefile for makerom.

* Update MakeROM github actions script.

* Fix again.

* Update MakeROM's makefile

* Tweak makerom build script

* Tweak MakeROM build script.

* Fix typo

* Update MakeROM makefiles.

* Tweak CTRTool build script.

* Tweak build script

* Tweak CTRTool build script.

* Tweak CTRTool build script

* Add libmbedtls to makerom deps

* Partially migrate makerom to libmbedtls

* Break out libblz as an external dependency for makerom.

* Tweak makerom build script.

* Move dependencies to the top level.

* Put everything back.

* misc

* Update makerom documentation.

* Link to ctrtool/makerom readmes from the root readme.

* Update root readme again.

* Migrate makerom to modern mbedtls

* Bump makerom version to 0.18.1

* Change signing errors to be warnings when they fail.

* Add error verbosity to errors when generating CIA files.

* Fix bug in RSA code.

* misc.

* Remove polarssl now migration to mbedtls complete.

* Surface more makerom errors.

* [makerom] Tolerate CCI signing errors as a warning.

* Add missing return.

* Import initial data key_x (prod/dev included)

* [makerom] Fix initial data generation.
  • Loading branch information
jakcron committed Apr 17, 2022
1 parent 8a9f9bd commit cc707c1
Show file tree
Hide file tree
Showing 290 changed files with 115,411 additions and 10,418 deletions.
28 changes: 15 additions & 13 deletions .github/workflows/Build_CTRTool.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,17 @@ jobs:
os: macos-latest
arch: arm64
steps:
- uses: actions/checkout@v1
- name: Clone submodules
run: git submodule init && git submodule update
- name: Compile ${{ matrix.prog }}
working-directory: ${{ matrix.prog }}
run: make PROJECT_PLATFORM_ARCH=${{ matrix.arch }} deps all
- uses: actions/upload-artifact@v2
with:
name: ${{ matrix.prog }}-${{ matrix.dist }}
path: ./${{ matrix.prog }}/bin/${{ matrix.prog }}
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Compile ${{ matrix.prog }}
working-directory: ${{ matrix.prog }}
run: make PROJECT_PLATFORM_ARCH=${{ matrix.arch }} deps all
- uses: actions/upload-artifact@v2
with:
name: ${{ matrix.prog }}-${{ matrix.dist }}
path: ./${{ matrix.prog }}/bin/${{ matrix.prog }}
if-no-files-found: error
build_visualstudio:
name: Compile ${{ matrix.prog }} for ${{ matrix.dist }}
runs-on: ${{ matrix.os }}
Expand All @@ -56,15 +57,16 @@ jobs:
configuration: Release
build_path: Release
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.1
- name: Clone submodules
run: git submodule init && git submodule update
- name: Compile ${{ matrix.prog }}
run: msbuild .\${{ matrix.prog }}\build\visualstudio\${{ matrix.prog }}.sln /p:configuration=${{ matrix.configuration }} /p:platform=${{ matrix.platform }}
- uses: actions/upload-artifact@v2
with:
name: ${{ matrix.prog }}-${{ matrix.dist }}
path: .\${{ matrix.prog }}\build\visualstudio\${{ matrix.build_path }}\${{ matrix.prog }}.exe
if-no-files-found: error

21 changes: 12 additions & 9 deletions .github/workflows/Build_MakeROM.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,31 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
dist: [ubuntu_x86_64, macos_x86_64, win_x86_64]
dist: [ubuntu_x86_64, macos_x86_64, macos_arm64, win_x86_64]
prog: [makerom]
include:
- dist: win_x86_64
os: windows-latest
makeArgs: -j $env:NUMBER_OF_PROCESSORS
binExt: .exe
- dist: ubuntu_x86_64
os: ubuntu-latest
makeArgs: -j$(nproc)
arch: x86_64
- dist: macos_x86_64
os: macos-latest
makeArgs: -j$(sysctl -n hw.activecpu)
arch: x86_64
- dist: macos_arm64
os: macos-latest
arch: arm64
- dist: win_x86_64
os: windows-latest
arch: x86_64
binExt: .exe
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Compile ${{ matrix.prog }}
working-directory: ${{ matrix.prog }}
run: make ${{ matrix.makeArgs }}
run: make PROJECT_PLATFORM_ARCH=${{ matrix.arch }} deps all
- uses: actions/upload-artifact@v2
with:
name: ${{ matrix.prog }}-${{ matrix.dist }}
path: ${{ matrix.prog }}/${{ matrix.prog }}${{ matrix.binExt }}
path: ./${{ matrix.prog }}/bin/${{ matrix.prog }}${{ matrix.binExt }}
if-no-files-found: error
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Project_CTR
===========
# Project_CTR
Project CTR is a collection of custom Nintendo 3DS tools.

ctrtool - a tool to read/extract Nintendo 3DS files.
## Tools
[ctrtool](ctrtool/README.md) - a tool to read/extract Nintendo 3DS files. ([download](https://github.com/3DSGuy/Project_CTR/releases/tag/ctrtool-v1.1.0))

makerom - creates CTR cxi/cfa/cci/cia files.
[makerom](makerom/README.md) - creates CTR cxi/cfa/cci/cia files. ([download](https://github.com/3DSGuy/Project_CTR/releases/tag/makerom-v0.18))
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{8a35d7dc-293a-4669-9c1e-4f45abfe8838}</ProjectGuid>
<RootNamespace>libnintendoesdrm</RootNamespace>
<RootNamespace>libbroadones</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
Expand Down
49 changes: 49 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Project Name
PROJECT_NAME = Project_CTR

# Project Relative Paths
PROJECT_PATH = $(CURDIR)
PROJECT_PROGRAM_LOCAL_DIR = ctrtool makerom

# Detect Platform
ifeq ($(PROJECT_PLATFORM),)
ifeq ($(OS), Windows_NT)
export PROJECT_PLATFORM = WIN32
else
UNAME = $(shell uname -s)
ifeq ($(UNAME), Darwin)
export PROJECT_PLATFORM = MACOS
else
export PROJECT_PLATFORM = GNU
endif
endif
endif

# Detect Architecture
ifeq ($(PROJECT_PLATFORM_ARCH),)
ifeq ($(PROJECT_PLATFORM), WIN32)
export PROJECT_PLATFORM_ARCH = x86_64
else ifeq ($(PROJECT_PLATFORM), GNU)
export PROJECT_PLATFORM_ARCH = $(shell uname -m)
else ifeq ($(PROJECT_PLATFORM), MACOS)
export PROJECT_PLATFORM_ARCH = $(shell uname -m)
else
export PROJECT_PLATFORM_ARCH = x86_64
endif
endif

# all is the default, user should specify what the default should do
# - 'deps' for building local dependencies.
# - 'program' for building executable programs.
all: progs

clean: clean_progs

# Programs
.PHONY: progs
progs:
@$(foreach prog,$(PROJECT_PROGRAM_LOCAL_DIR), cd "$(prog)" && $(MAKE) deps program && cd "$(PROJECT_PATH)";)

.PHONY: clean_progs
clean_progs:
@$(foreach prog,$(PROJECT_PROGRAM_LOCAL_DIR), cd "$(prog)" && $(MAKE) clean_deps clean && cd "$(PROJECT_PATH)";)
13 changes: 13 additions & 0 deletions makerom/BUILDING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Building
## Linux (incl. Windows Subsystem for Linux) & MacOS & Windows (MinGW)- Makefile
### Requirements
* `make`
* Terminal access
* Typical GNU compatible development tools (e.g. `clang`, `gcc`, `ar` etc) with __C11__ support

### Using Makefile
* `make` (default) - Compile program
* Compiling the program requires local dependencies to be compiled via `make deps` beforehand
* `make clean` - Remove executable and object files
* `make deps` - Compile locally included dependency libraries
* `make clean_deps` - Remove compiled library binaries and object files
2 changes: 1 addition & 1 deletion makerom/LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ MIT License

Copyright (c) 2014 3DSGuy
Copyright (c) 2014 applestash
Copyright (c) 2015-2016 Jakcron
Copyright (c) 2015-2022 Jakcron

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
37 changes: 0 additions & 37 deletions makerom/Makefile

This file was deleted.

0 comments on commit cc707c1

Please sign in to comment.