aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorspicyjpeg <88942473+spicyjpeg@users.noreply.github.com>2021-11-20 01:09:33 +0100
committerspicyjpeg <88942473+spicyjpeg@users.noreply.github.com>2021-11-20 01:09:33 +0100
commit9b00e5f7ff163a8fc6f341dbf237d90c61dadddc (patch)
treed20c80fbd4f5a5d1d3972669625972cea6b3684d
parent853fa4eed241cdd87b8c2d2e60cf755509d9a184 (diff)
downloadpsn00bsdk-9b00e5f7ff163a8fc6f341dbf237d90c61dadddc.tar.gz
Fixed macOS installation bug, updated INSTALL.md
-rw-r--r--CMakeLists.txt19
-rw-r--r--CMakePresets.json4
-rw-r--r--INSTALL.md33
-rw-r--r--changelog.txt19
-rw-r--r--doc/dev notes.txt34
5 files changed, 92 insertions, 17 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0e6eefd..87980a5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -98,12 +98,21 @@ ExternalProject_Add(
# Install all files in the temporary installation tree, as well as static files
# from the source tree, when "cmake --install" is invoked.
-install(
- DIRECTORY ${PROJECT_BINARY_DIR}/install_tree/ # THE TRAILING SLASH IS IMPORTANT
- DESTINATION .
- COMPONENT sdk
- USE_SOURCE_PERMISSIONS
+foreach(
+ _subdir IN ITEMS
+ ${CMAKE_INSTALL_BINDIR}
+ ${CMAKE_INSTALL_LIBDIR}
+ ${CMAKE_INSTALL_DATADIR}
)
+ install(
+ # THE TRAILING SLASH IS IMPORTANT
+ DIRECTORY ${PROJECT_BINARY_DIR}/install_tree/${_subdir}/
+ DESTINATION ${_subdir}
+ COMPONENT sdk
+ USE_SOURCE_PERMISSIONS
+ )
+endforeach()
+
install(
DIRECTORY doc template
DESTINATION ${CMAKE_INSTALL_DATADIR}/psn00bsdk
diff --git a/CMakePresets.json b/CMakePresets.json
index 50cf671..f550e82 100644
--- a/CMakePresets.json
+++ b/CMakePresets.json
@@ -1,8 +1,8 @@
{
- "version": 3,
+ "version": 2,
"cmakeMinimumRequired": {
"major": 3,
- "minor": 21,
+ "minor": 20,
"patch": 0
},
"configurePresets": [
diff --git a/INSTALL.md b/INSTALL.md
index d0a2cd7..5ae56f5 100644
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -4,14 +4,15 @@
## Building and installing
The instructions below are for Windows and Linux. Building on macOS hasn't been
-tested.
+tested extensively yet, however it should work once the GCC toolchain is built
+and installed properly.
1. Install prerequisites and a host compiler toolchain. On Linux (most distros)
install the following packages from your distro's package manager:
- `git`
- `build-essential`, `base-devel` or similar
- - `ninja-build`
+ - `make` or `ninja-build`
- `cmake` (3.20+ is required, download it from
[here](https://cmake.org/download) if your package manager only provides
older versions)
@@ -20,11 +21,11 @@ tested.
MSYS" shell and run this command:
```bash
- pacman -Syu git mingw-w64-x86_64-ninja mingw-w64-x86_64-cmake mingw-w64-x86_64-g++
+ pacman -Syu git mingw-w64-x86_64-make mingw-w64-x86_64-ninja mingw-w64-x86_64-cmake mingw-w64-x86_64-gcc
```
- **NOTE**: if you are prompted to close the shell, you may have to reopen it
- afterwards and rerun the command to finish installation.
+ If you are prompted to close the shell, you may have to reopen it afterwards
+ and rerun the command to finish installation.
**Do not use the MSys2 shell for the next steps**, use a regular command
prompt or PowerShell instead.
@@ -40,6 +41,12 @@ tested.
version from [Lameguy64's website](http://lameguy64.net?page=psn00bsdk) and
extract it into one of the directories listed below instead.
+ **NOTE**: PSn00bSDK is also compatible with toolchains that target
+ `mipsel-none-elf`. If you already have such a toolchain (e.g. because you
+ have another PS1 SDK installed) you can skip this step. Make sure you pass
+ `-DPSN00BSDK_TARGET=mipsel-none-elf` to CMake when configuring the SDK
+ though (see step 5).
+
3. If you chose a non-standard install location for the toolchain, add the
`bin` subfolder (inside the top-level toolchain directory) to the `PATH`
environment variable. This step is unnecessary if you installed/extracted
@@ -68,7 +75,14 @@ tested.
If you want to install the SDK to a custom location rather than the default
one (`C:\Program Files\PSn00bSDK` or `/usr/local` depending on your OS), add
- `--install-prefix <INSTALL_PATH>` to the first command.
+ `--install-prefix <INSTALL_PATH>` to the first command. Add
+ `-DPSN00BSDK_TARGET=mipsel-none-elf` if your toolchain targets
+ `mipsel-none-elf` rather than `mipsel-unknown-elf`.
+
+ **NOTE**: Ninja is used by default to build the SDK. If you can't get it to
+ work or don't have it installed, pass `-G "Unix Makefiles"` (or
+ `-G "MSYS Makefiles"` on Windows) to the first command to build using `make`
+ instead.
6. Install the SDK to the path you chose (add `sudo` or run it from a command
prompt with admin privileges if necessary):
@@ -104,7 +118,8 @@ far from being feature-complete.
[NSIS](https://nsis.sourceforge.io/Download) on Windows or `dpkg` and `rpm`
on Linux.
-2. Run the following commands from the PSn00bSDK directory:
+2. Run the following commands from the PSn00bSDK directory (pass the
+ appropriate options to the first command if necessary):
```bash
cmake --preset package .
@@ -121,7 +136,7 @@ far from being feature-complete.
2. Configure and build the template by running:
```bash
- cmake -S . -B ./build -G Ninja
+ cmake -S . -B ./build
cmake --build ./build
```
@@ -138,4 +153,4 @@ The toolchain script defines a few CMake macros to create PS1 executables, DLLs
and CD images. See the [reference](doc/cmake_reference.md) for details.
-----------------------------------------
-_Last updated on 2021-10-31 by spicyjpeg_
+_Last updated on 2021-11-19 by spicyjpeg_
diff --git a/changelog.txt b/changelog.txt
index 041bbc5..3efa7a0 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -2,6 +2,25 @@ PSn00bSDK changelog
Items that are lower in the log are more recently implemented.
+11-19-2021 by spicyjpeg:
+
+* libc: Removed STACK_MAX_SIZE and added _mem_init() back. RAM and stack size
+ can now be set by calling _mem_init() manually before allocating any memory.
+
+* libc: sprintf() now supports fixed padding when using %@ (binary integer).
+
+* psxapi: Added wrapper around BIOS function GetSystemInfo().
+
+* examples: Added pads example. Also added CMake build script to cartrom, which
+ is now built alongside all other examples.
+
+* Deprecated malloc.h and removed all references to it (stdlib.h should be used
+ instead). Moved int*_t and uint*_t types to stdint.h.
+
+* Fixed file permission errors when attempting to install the SDK on macOS.
+ Made some small updates to INSTALL.md.
+
+
10-31-2021 by spicyjpeg:
* Added tinyxml2 and mkpsxiso as git submodules and removed the (admittedly
diff --git a/doc/dev notes.txt b/doc/dev notes.txt
index d825ee7..3aa2db5 100644
--- a/doc/dev notes.txt
+++ b/doc/dev notes.txt
@@ -76,7 +76,7 @@ the pad in analog mode you must:
games) to increase timing accuracy.
* If a digital pad response (type = 4) is received from a port that hasn't
previously been flagged as digital-only, attempt to put the pad into config
- mode using command 43h.
+ mode using command 43h *twice* (as the proper response is delayed).
* If the pad doesn't recognize the config command, flag it as digital-only
and treat all further digital pad responses from it as valid.
* If the pad recognizes the command, it will reply by identifying as an
@@ -166,6 +166,38 @@ cache or something like that (?). The only workaround I know of is to use
CPACK_PRE_BUILD_SCRIPTS to trigger a custom script that deletes anything other
than the actual files to be packaged (see cpack/fakeroot_fix.cmake).
+* Project installation might fail on macOS (and possibly some Linux distros) if
+CMake attempts to set permissions on system directories such as /usr/local.
+This is usually caused by install() commands that copy files to the root
+installation directory rather than to a subfolder, like this:
+
+ install(
+ DIRECTORY install_tree/
+ DESTINATION .
+ USE_SOURCE_PERMISSIONS
+ )
+
+If the USE_SOURCE_PERMISSIONS flag is specified CMake will attempt to set
+permissions on the DESTINATION folder, which in this case would be the root
+prefix (/usr/local by default on macOS), to match the source directory. This
+will however fail as macOS restricts top-level system directories from having
+their permissions changed. The simplest workaround is to avoid using
+"DESTINATION ." and install each subdirectory explicitly instead, like this:
+
+ foreach(
+ _dir IN ITEMS
+ ${CMAKE_INSTALL_BINDIR}
+ ${CMAKE_INSTALL_LIBDIR}
+ ${CMAKE_INSTALL_INCLUDEDIR}
+ ${CMAKE_INSTALL_DATADIR}
+ )
+ install(
+ DIRECTORY install_tree/${_dir}/
+ DESTINATION ${_dir}
+ USE_SOURCE_PERMISSIONS
+ )
+ endforeach()
+
* Depending on how you find external dependencies (find_package(), vcpkg,
pkg-config...), CMake may end up outputting an executable that relies on a DLL
installed system-wide. To correctly install the DLL alongside the executable