From c6548f077282f871bc22bd05595d3a1139f50a80 Mon Sep 17 00:00:00 2001
From: spicyjpeg <88942473+spicyjpeg@users.noreply.github.com>
Date: Sun, 12 Sep 2021 19:39:02 +0200
Subject: Added preliminary files for CMake/CPack support
---
cpack/convert_images.sh | 45 +++++++++++++
cpack/description.txt | 27 ++++++++
cpack/fakeroot_fix.cmake | 32 +++++++++
cpack/icon.ico | Bin 0 -> 194619 bytes
cpack/icon.svg | 164 +++++++++++++++++++++++++++++++++++++++++++++++
cpack/nsis_banner.bmp | Bin 0 -> 42622 bytes
cpack/nsis_banner.svg | 162 ++++++++++++++++++++++++++++++++++++++++++++++
cpack/nsis_header.bmp | Bin 0 -> 4220 bytes
cpack/nsis_header.svg | 66 +++++++++++++++++++
cpack/uninstall.ico | Bin 0 -> 194619 bytes
cpack/uninstall.svg | 164 +++++++++++++++++++++++++++++++++++++++++++++++
cpack/welcome.txt | 3 +
12 files changed, 663 insertions(+)
create mode 100644 cpack/convert_images.sh
create mode 100644 cpack/description.txt
create mode 100644 cpack/fakeroot_fix.cmake
create mode 100644 cpack/icon.ico
create mode 100644 cpack/icon.svg
create mode 100644 cpack/nsis_banner.bmp
create mode 100644 cpack/nsis_banner.svg
create mode 100644 cpack/nsis_header.bmp
create mode 100644 cpack/nsis_header.svg
create mode 100644 cpack/uninstall.ico
create mode 100644 cpack/uninstall.svg
create mode 100644 cpack/welcome.txt
(limited to 'cpack')
diff --git a/cpack/convert_images.sh b/cpack/convert_images.sh
new file mode 100644
index 0000000..3816dec
--- /dev/null
+++ b/cpack/convert_images.sh
@@ -0,0 +1,45 @@
+#!/bin/bash
+# This script generates Windows bitmaps from the SVGs in this directory. The
+# bitmaps are displayed by the NSIS installers generated using CPack. Inkscape
+# and ImageMagick must be installed for this script to work.
+
+INDEXED_SIZES=(16 24 32 48)
+RGB_ONLY_SIZES=(64 96 128 256)
+DITHER_OPTIONS="-dither riemersma"
+OUTPUT_OPTIONS="+compress -strip"
+
+svg_to_bitmap() {
+ inkscape -z -e rgb.png $1
+
+ # There seems to be no way to tell ImageMagick to generate an 8-bit indexed
+ # BMP directly, so the image has to be converted to indexed PNG first. NSIS
+ # seems to reject all BMP versions other than "bmp3".
+ convert $DITHER_OPTIONS -colors 256 +remap rgb.png png8:i8.png
+ convert i8.png $OUTPUT_OPTIONS bmp3:$2
+ rm -f rgb.png i8.png
+}
+
+# https://stackoverflow.com/a/52636645
+svg_to_icon() {
+ for size in ${INDEXED_SIZES[@]} ${RGB_ONLY_SIZES[@]}; do
+ inkscape -z -e $size.png -w $size -h $size $1
+ done
+
+ # Windows expects some of the smaller sizes to be available in 4- and 8-bit
+ # indexed color formats, as well as RGB.
+ for size in ${INDEXED_SIZES[@]}; do
+ convert $DITHER_OPTIONS -colors 256 +remap $size.png png8:$size-i8.png
+ convert $DITHER_OPTIONS -colors 16 +remap $size.png png8:$size-i4.png
+ done
+
+ icons="${INDEXED_SIZES[@]/%/.png} ${INDEXED_SIZES[@]/%/-i8.png} ${INDEXED_SIZES[@]/%/-i4.png} ${RGB_ONLY_SIZES[@]/%/.png}"
+ convert $icons $OUTPUT_OPTIONS $2
+ rm -f $icons
+}
+
+rm -f *.ico *.bmp
+
+svg_to_icon icon.svg icon.ico
+svg_to_icon uninstall.svg uninstall.ico
+svg_to_bitmap nsis_banner.svg nsis_banner.bmp
+svg_to_bitmap nsis_header.svg nsis_header.bmp
diff --git a/cpack/description.txt b/cpack/description.txt
new file mode 100644
index 0000000..240b7d1
--- /dev/null
+++ b/cpack/description.txt
@@ -0,0 +1,27 @@
+PSn00bSDK is a 100% free and open source SDK project for the original Sony
+PlayStation for developing homebrew applications and games for the console
+100% freely. This SDK can be used for freeware, commercial, and open source
+homebrew projects.
+
+The SDK is composed mainly of libraries (libpsn00b) and some utilities that
+provide a basic framework for developing software for the PlayStation
+hardware, the compiler is separate (GCC) and should be acquired from GNU.
+The library API is intentionally written to resemble the library API of the
+official libraries as closely as possible. This design decision is not only
+for familiarity reasons to experienced programmers, but also so that existing
+sample code and tutorials would still apply to this SDK, as well as making
+the process of porting over existing homebrew originally made with official
+SDKs easier with minimal modification, provided it doesn't use libgs.
+
+PSn00bSDK is currently a work in progress and cannot really be considered
+production ready, but what is currently implemented should be enough to
+produce some interesting homebrew with the SDK, especially with its extensive
+support for the GPU and GTE hardware. There's no reason not to fully support
+hardware features of a target platform when said hardware features have been
+fully documented for years (nocash's PSX specs document in this case).
+
+Most of libpsn00b is written mostly in MIPS assembly, moreso functions that
+interface with the hardware. Many of the standard C functions are implemented
+in custom MIPS assembly instead of equivalents found in the BIOS ROM, for both
+stability (the BIOS libc implementation of the PlayStation is actually buggy)
+and performance reasons.
diff --git a/cpack/fakeroot_fix.cmake b/cpack/fakeroot_fix.cmake
new file mode 100644
index 0000000..e34baa0
--- /dev/null
+++ b/cpack/fakeroot_fix.cmake
@@ -0,0 +1,32 @@
+# This script works around a bug in CPack's DEB/RPM generator, which causes
+# files installed by subprojects (not by the main CMake script) to end up in
+# packages alongside the "real" installation directory. It probably happens due
+# to CMake running under fakeroot (when invoked by CPack to prepare the files
+# to be packaged) and referencing absolute paths, which would explain why the
+# entire build directory tree is replicated inside the packages. What this
+# script does is simply finding and deleting all directories that do not match
+# the installation prefix before CPack generates the package.
+
+cmake_minimum_required(VERSION 3.21)
+
+set(_prefix ${CPACK_TEMPORARY_INSTALL_DIRECTORY}${CPACK_PACKAGING_INSTALL_PREFIX})
+
+file(
+ GLOB_RECURSE _entries
+ LIST_DIRECTORIES ON
+ ${CPACK_TEMPORARY_INSTALL_DIRECTORY}/*
+)
+
+foreach(_entry IN LISTS _entries)
+ # Skip the entry if it (or its parent directory) has already been deleted.
+ if(NOT EXISTS ${_entry})
+ continue()
+ endif()
+
+ # Delete anything whose path doesn't start with the expected prefix.
+ string(FIND ${_entry} ${_prefix} _index)
+ if(NOT _index EQUAL 0)
+ message(NOTICE "Deleting unneeded entry from package: ${_entry}")
+ file(REMOVE_RECURSE ${_entry})
+ endif()
+endforeach()
diff --git a/cpack/icon.ico b/cpack/icon.ico
new file mode 100644
index 0000000..6759d23
Binary files /dev/null and b/cpack/icon.ico differ
diff --git a/cpack/icon.svg b/cpack/icon.svg
new file mode 100644
index 0000000..70d400d
--- /dev/null
+++ b/cpack/icon.svg
@@ -0,0 +1,164 @@
+
+
diff --git a/cpack/nsis_banner.bmp b/cpack/nsis_banner.bmp
new file mode 100644
index 0000000..831c8f9
Binary files /dev/null and b/cpack/nsis_banner.bmp differ
diff --git a/cpack/nsis_banner.svg b/cpack/nsis_banner.svg
new file mode 100644
index 0000000..499bb94
--- /dev/null
+++ b/cpack/nsis_banner.svg
@@ -0,0 +1,162 @@
+
+
diff --git a/cpack/nsis_header.bmp b/cpack/nsis_header.bmp
new file mode 100644
index 0000000..d677e8c
Binary files /dev/null and b/cpack/nsis_header.bmp differ
diff --git a/cpack/nsis_header.svg b/cpack/nsis_header.svg
new file mode 100644
index 0000000..19ae01a
--- /dev/null
+++ b/cpack/nsis_header.svg
@@ -0,0 +1,66 @@
+
+
diff --git a/cpack/uninstall.ico b/cpack/uninstall.ico
new file mode 100644
index 0000000..6759d23
Binary files /dev/null and b/cpack/uninstall.ico differ
diff --git a/cpack/uninstall.svg b/cpack/uninstall.svg
new file mode 100644
index 0000000..70d400d
--- /dev/null
+++ b/cpack/uninstall.svg
@@ -0,0 +1,164 @@
+
+
diff --git a/cpack/welcome.txt b/cpack/welcome.txt
new file mode 100644
index 0000000..e024336
--- /dev/null
+++ b/cpack/welcome.txt
@@ -0,0 +1,3 @@
+This installer will set up PSn00bSDK, including prebuilt libraries, CMake scripts as well as several command-line utilities for PlayStation 1 homebrew development.
+
+NOTE: CMake and the GCC toolchain must be installed separately.
--
cgit v1.2.3