-
-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automatically export support and tools to its own repository.
- Loading branch information
1 parent
b77a035
commit 801fd95
Showing
6 changed files
with
356 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2019 PCSX-Redux authors | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,186 @@ | ||
BUILD ?= Release | ||
DESTDIR ?= /usr/local | ||
CROSS ?= none | ||
|
||
UNAME_S := $(shell uname -s) | ||
UNAME_M := $(shell uname -m) | ||
rwildcard=$(wildcard $1$2) $(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2)) | ||
CC_IS_CLANG := $(shell $(CC) --version | grep -q clang && echo true || echo false) | ||
|
||
PACKAGES := zlib | ||
|
||
ifeq ($(wildcard third_party/ELFIO/elfio/elfio.hpp),) | ||
HAS_SUBMODULES = false | ||
else | ||
HAS_SUBMODULES = true | ||
endif | ||
|
||
CXXFLAGS += -std=c++2b | ||
CPPFLAGS += `pkg-config --cflags $(PACKAGES)` | ||
CPPFLAGS += -I. | ||
CPPFLAGS += -Isrc | ||
CPPFLAGS += -Ithird_party | ||
CPPFLAGS += -Ithird_party/ELFIO | ||
CPPFLAGS += -Ithird_party/fmt/include/ | ||
CPPFLAGS += -Ithird_party/googletest/googletest/include | ||
CPPFLAGS += -Ithird_party/ucl -Ithird_party/ucl/include | ||
CPPFLAGS += -g | ||
|
||
CPPFLAGS_Release += -O3 | ||
CPPFLAGS_Debug += -O0 | ||
CPPFLAGS_Coverage += -O0 | ||
ifeq ($(CC_IS_CLANG),true) | ||
CPPFLAGS_Coverage += -fprofile-instr-generate -fcoverage-mapping | ||
else | ||
CPPFLAGS_Coverage += -fprofile-arcs -ftest-coverage | ||
endif | ||
CPPFLAGS_asan += -O1 -fsanitize=address -fno-omit-frame-pointer | ||
CPPFLAGS_ubsan += -O1 -fsanitize=undefined -fno-omit-frame-pointer | ||
CPPFLAGS_lto += -O3 -flto=auto -fno-fat-lto-objects -flto-partition=one | ||
|
||
ifeq ($(CC_IS_CLANG),true) | ||
CXXFLAGS += -fcoroutines-ts | ||
else | ||
CXXFLAGS += -fcoroutines | ||
endif | ||
|
||
ifeq ($(UNAME_S),Darwin) | ||
CPPFLAGS += -mmacosx-version-min=10.15 | ||
CPPFLAGS += -stdlib=libc++ | ||
endif | ||
|
||
LDFLAGS += `pkg-config --libs $(PACKAGES)` | ||
|
||
ifeq ($(UNAME_S),Darwin) | ||
LDFLAGS += -lc++ | ||
LDFLAGS += -mmacosx-version-min=10.15 | ||
else | ||
LDFLAGS += -lstdc++fs | ||
endif | ||
|
||
LDFLAGS += -ldl | ||
LDFLAGS += -g | ||
|
||
ifeq ($(CC_IS_CLANG),true) | ||
LDFLAGS_Coverage += -fprofile-instr-generate -fcoverage-mapping | ||
else | ||
LDFLAGS_Coverage += -fprofile-arcs -ftest-coverage | ||
endif | ||
LDFLAGS_asan += -fsanitize=address | ||
LDFLAGS_ubsan += -fsanitize=undefined | ||
LDFLAGS_lto += -O3 -flto=auto -flto-partition=one | ||
|
||
CPPFLAGS += $(CPPFLAGS_$(BUILD)) -pthread | ||
LDFLAGS += $(LDFLAGS_$(BUILD)) -pthread | ||
|
||
ifeq ($(CROSS),arm64) | ||
CPPFLAGS += -fPIC -Wl,-rpath-link,/opt/cross/sysroot/usr/lib/aarch64-linux-gnu -L/opt/cross/sysroot/usr/lib/aarch64-linux-gnu | ||
LDFLAGS += -fPIC -Wl,-rpath-link,/opt/cross/sysroot/usr/lib/aarch64-linux-gnu -L/opt/cross/sysroot/usr/lib/aarch64-linux-gnu | ||
endif | ||
|
||
LD := $(CXX) | ||
|
||
SRCS := $(call rwildcard,src/,*.cc) | ||
SRCS += third_party/fmt/src/os.cc third_party/fmt/src/format.cc | ||
SRCS += $(wildcard third_party/cueparser/*.c) | ||
SRCS += $(wildcard third_party/iec-60908b/*.c) | ||
SRCS += third_party/ucl/src/n2e_99.c third_party/ucl/src/alloc.c | ||
|
||
TOOLS = exe2elf exe2iso ps1-packer psyq-obj-parser | ||
|
||
############################################################################## | ||
|
||
OBJECTS += $(patsubst %.c,%.o,$(filter %.c,$(SRCS))) | ||
OBJECTS += $(patsubst %.cc,%.o,$(filter %.cc,$(SRCS))) | ||
OBJECTS += $(patsubst %.cpp,%.o,$(filter %.cpp,$(SRCS))) | ||
OBJECTS += $(patsubst %.mm,%.o,$(filter %.mm,$(SRCS))) | ||
|
||
TESTS_SRC := $(call rwildcard,tests/,*.cc) | ||
TESTS := $(patsubst %.cc,%,$(TESTS_SRC)) | ||
|
||
CP ?= cp | ||
MKDIRP ?= mkdir -p | ||
|
||
all: check_submodules dep tools | ||
|
||
ifeq ($(HAS_SUBMODULES),true) | ||
check_submodules: | ||
|
||
else | ||
check_submodules: | ||
@echo "You need to clone this repository recursively, in order to get its submodules." | ||
@false | ||
endif | ||
|
||
strip: all | ||
strip $(TOOLS) | ||
|
||
install: all strip | ||
$(MKDIRP) $(DESTDIR)/bin | ||
$(CP) $(TOOLS) $(DESTDIR)/bin | ||
|
||
%.o: %.c | ||
$(CC) -c -o $@ $< $(CPPFLAGS) $(EXTRA_CPPFLAGS) $(CFLAGS) | ||
|
||
%.o: %.cc | ||
$(CXX) -c -o $@ $< $(CPPFLAGS) $(EXTRA_CPPFLAGS) $(CXXFLAGS) | ||
|
||
%.o: %.cpp | ||
$(CXX) -c -o $@ $< $(CPPFLAGS) $(EXTRA_CPPFLAGS) $(CXXFLAGS) | ||
|
||
%.o: %.mm | ||
$(CC) -c -o $@ $< $(CPPFLAGS) $(EXTRA_CPPFLAGS) $(CFLAGS) | ||
|
||
%.dep: %.c | ||
$(CC) $(CPPFLAGS) $(EXTRA_CPPFLAGS) $(CFLAGS) -M -MT $(addsuffix .o, $(basename $@)) -MF $@ $< | ||
|
||
%.dep: %.cc | ||
$(CXX) $(CPPFLAGS) $(EXTRA_CPPFLAGS) $(CXXFLAGS) -M -MT $(addsuffix .o, $(basename $@)) -MF $@ $< | ||
|
||
%.dep: %.cpp | ||
$(CXX) $(CPPFLAGS) $(EXTRA_CPPFLAGS) $(CXXFLAGS) -M -MT $(addsuffix .o, $(basename $@)) -MF $@ $< | ||
|
||
clean: | ||
rm -f $(OBJECTS) $(TARGET) $(DEPS) gtest-all.o gtest_main.o | ||
|
||
gtest-all.o: $(wildcard third_party/googletest/googletest/src/*.cc) | ||
$(CXX) -O3 -g $(CXXFLAGS) -Ithird_party/googletest/googletest -Ithird_party/googletest/googletest/include -c third_party/googletest/googletest/src/gtest-all.cc | ||
|
||
gtest_main.o: third_party/googletest/googletest/src/gtest_main.cc | ||
$(CXX) -O3 -g $(CXXFLAGS) -Ithird_party/googletest/googletest -Ithird_party/googletest/googletest/include -c third_party/googletest/googletest/src/gtest_main.cc | ||
|
||
gitclean: | ||
git clean -f -d -x | ||
git submodule foreach --recursive git clean -f -d -x | ||
|
||
tests: $(foreach t,$(TESTS),$(t).o) $(NONMAIN_OBJECTS) gtest-all.o gtest_main.o | ||
$(LD) -o tests $(NONMAIN_OBJECTS) gtest-all.o gtest_main.o $(foreach t,$(TESTS),$(t).o) -Ithird_party/googletest/googletest/include $(LDFLAGS) | ||
|
||
runtests: tests | ||
./tests | ||
|
||
define TOOLDEF | ||
$(1): $(OBJECTS) tools/$(1)/$(1).o | ||
$(LD) -o $(1) $(CPPFLAGS) $(CXXFLAGS) $(OBJECTS) tools/$(1)/$(1).o -static $(LDFLAGS) | ||
|
||
endef | ||
|
||
$(foreach tool,$(TOOLS),$(eval $(call TOOLDEF,$(tool)))) | ||
|
||
tools: $(TOOLS) | ||
|
||
.PHONY: all dep clean gitclean runtests install strip tools | ||
|
||
DEPS += $(patsubst %.c,%.dep,$(filter %.c,$(SRCS))) | ||
DEPS := $(patsubst %.cc,%.dep,$(filter %.cc,$(SRCS))) | ||
DEPS += $(patsubst %.cpp,%.dep,$(filter %.cpp,$(SRCS))) | ||
|
||
dep: $(DEPS) | ||
|
||
ifneq ($(MAKECMDGOALS), clean) | ||
ifneq ($(MAKECMDGOALS), gitclean) | ||
ifeq ($(HAS_SUBMODULES), true) | ||
-include $(DEPS) | ||
endif | ||
endif | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# PCSX-Redux's Support & Tools | ||
|
||
This repository is a read-only reduced mirror of | ||
[the PCSX-Redux project](https://github.com/grumpycoders/pcsx-redux). It only contains the necessary parts to build the [tools](https://github.com/grumpycoders/pcsx-redux/tree/main/tools) only, as well as the [support libraries](https://github.com/grumpycoders/pcsx-redux/tree/main/support). | ||
Its purpose is to be used as a submodule for projects that want to use the tools and libraries | ||
contained herein without bringing the whole of PCSX-Redux's codebase. | ||
|
||
Please consult [the upstream repository](https://github.com/grumpycoders/pcsx-redux) and [its documentation](https://pcsx-redux.consoledev.net) for more information. There is also some documentation nested within the folders. | ||
|
||
This repository will be updated periodically to match the upstream repository, and its history will be rewritten to remove all commits that are not related to the tools. While care is taken to try and ensure some sort of consistency, a simple `git pull` may not work to update it. Resetting to the remote HEAD is recommended when updating. | ||
|
||
All of the code here is MIT-licensed. See the [LICENSE](LICENSE) file for more information. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name: Close Pull Request | ||
|
||
on: | ||
pull_request_target: | ||
types: [opened] | ||
|
||
jobs: | ||
run: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: superbrothers/close-pull-request@v3 | ||
with: | ||
comment: "Thank you for your pull request, but this repository is a read-only mirror of the [PCSX-Redux project](https://github.com/grumpycoders/pcsx-redux). Please open your pull request there instead." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
ROOT=$(dirname $0) | ||
CWD=$(pwd) | ||
cd $ROOT | ||
ROOT=$(pwd) | ||
cd $CWD | ||
|
||
# Delete non-tools source code | ||
git filter-branch -f --tree-filter '(mv src/mips . || true) && (mv src/support . || true) && (mv src/supportpsx . || true) && rm -rf src && mkdir -p src && (mv mips src || true) && (mv support src || true) && mv supportpsx src || true' --tag-name-filter cat --prune-empty | ||
git filter-branch -f --tree-filter 'find src/mips -depth -type f -not -path src/mips/common/\* -delete || true' --tag-name-filter cat --prune-empty | ||
|
||
# Delete some root files. | ||
git filter-branch -f --tree-filter 'rm -f *.yml LICENSE* mips.ps1 TODO.md' --tag-name-filter cat --prune-empty | ||
|
||
# Delete irrelevant folders | ||
git filter-branch -f --tree-filter 'rm -rf .github hardware i18n resources .vscode vsprojects tests/pcsxrunner' --tag-name-filter cat --prune-empty | ||
|
||
# Need to delete submodules actively. | ||
# Done in two passes for speed. | ||
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/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/ucl\* -exec git rm -f {} \; || true' --tag-name-filter cat --prune-empty | ||
|
||
# Delete ffmpeg, versionning, Lua, and libuv-related source code | ||
git filter-branch -f --tree-filter 'find src -type f -name \*lua\* -delete || true' --tag-name-filter cat --prune-empty | ||
git filter-branch -f --tree-filter 'find src -type f -name assembler.\* -delete || true' --tag-name-filter cat --prune-empty | ||
git filter-branch -f --tree-filter 'find src -type f -name ffmpeg\* -delete || true' --tag-name-filter cat --prune-empty | ||
git filter-branch -f --tree-filter 'find src -type f -name uv\* -delete || true' --tag-name-filter cat --prune-empty | ||
git filter-branch -f --tree-filter 'find src -type f -name version\* -delete || true' --tag-name-filter cat --prune-empty | ||
|
||
# Inject our new root files. | ||
git filter-branch -f --tree-filter "cp ${ROOT}/README-filtered.md README.md && cp ${ROOT}/LICENSE-filtered LICENSE && cp ${ROOT}/Makefile-filtered Makefile && mkdir -p .github/workflows && cp ${ROOT}/close.yml .github/workflows" --tag-name-filter cat |
Oops, something went wrong.