├── .github └── workflows │ └── compilation.yml ├── .gitignore ├── LICENSE ├── README.md ├── common.sh ├── config ├── makepkg.conf └── pacman.conf ├── pacman-sudo.sh ├── pacman.sh ├── patches └── pacman-6.0.1.patch └── scripts ├── psp-makepkg └── psp-pacman /.github/workflows/compilation.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: 4 | push: 5 | pull_request: 6 | repository_dispatch: 7 | types: [run_build] 8 | 9 | jobs: 10 | build: 11 | runs-on: ubuntu-latest 12 | container: alpine:latest 13 | steps: 14 | 15 | - name: Install dependencies 16 | run: | 17 | apk add git build-base bash python3 py3-pip cmake pkgconfig libarchive-dev openssl-dev gpgme-dev 18 | 19 | - uses: actions/checkout@v4 20 | 21 | - name: Compile project 22 | run: | 23 | chown -R $(id -nu):$(id -ng) . 24 | export PSPDEV=$PWD/pspdev 25 | export PATH=$PATH:$PSPDEV/bin 26 | ./pacman.sh 27 | export PATH=$PATH:$PSPDEV/bin 28 | psp-pacman -V 29 | psp-makepkg -V 30 | 31 | build-VM: 32 | runs-on: ${{ matrix.os[0] }} 33 | strategy: 34 | matrix: 35 | os: [[macos-latest, bash], [ubuntu-latest, bash]] 36 | fail-fast: false 37 | defaults: 38 | run: 39 | shell: ${{ matrix.os[1] }} {0} 40 | 41 | steps: 42 | - uses: actions/checkout@v4 43 | 44 | - name: Install Ubuntu texinfo bison flex libucl-dev 45 | if: matrix.os[0] == 'ubuntu-latest' 46 | run: | 47 | sudo apt-get -y install texinfo bison flex gettext libgmp3-dev libmpfr-dev libmpc-dev libusb-dev libreadline-dev libcurl4 libcurl4-openssl-dev libssl-dev libarchive-dev libgpgme-dev 48 | echo "MSYSTEM=x64" >> $GITHUB_ENV 49 | 50 | - name: Install Mac texinfo bison flex ucl 51 | if: matrix.os[0] == 'macOS-latest' 52 | run: | 53 | brew install gettext texinfo bison flex gnu-sed ncurses gsl gmp mpfr autoconf automake cmake libusb-compat libarchive gpgme bash openssl libtool 54 | gsed -i '/Requires.private: iconv/d' /usr/local/opt/libarchive/lib/pkgconfig/libarchive.pc || true 55 | echo "MSYSTEM=x64" >> $GITHUB_ENV 56 | 57 | - name: Compile Tools 58 | run: | 59 | export PATH="$(brew --prefix gnu-sed)/libexec/gnubin:$PATH" # This really is only needed for macOS 60 | export PATH="$(brew --prefix libtool)/libexec/gnubin:$PATH" # This really is only needed for macOS 61 | export PKG_CONFIG_PATH="$(brew --prefix libarchive)/lib/pkgconfig:$(brew --prefix openssl)/lib/pkgconfig" #This really is only needed for macOS 62 | export PSPDEV=$PWD/pspdev 63 | ./pacman.sh 64 | export PATH=$PATH:$PSPDEV/bin 65 | psp-pacman -V 66 | psp-makepkg -V 67 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.swp 2 | *~ 3 | build/ 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PSP Pacman 2 | 3 | This respository contains all the files needed to build and install the pacman package managed for the PSP toolchain. Pacman can be used to build and manage packages with libraries for the PSP. 4 | 5 | This package provides the following commands: 6 | - **psp-pacman** - Allows users to install and manage PSP library packages. 7 | - **psp-makepkg** - Allows users to build packages from PSPBUILD files. 8 | 9 | ## Dependencies 10 | 11 | On Ubuntu/Debian, the following packages need to be installed: 12 | - build-essential 13 | - gettext (optional to add support for other languages than english) 14 | - libarchive-dev 15 | - libarchive-tools 16 | - libcurl4-openssl-dev 17 | - libgpgme-dev 18 | - libssl-dev 19 | - m4 20 | - pkg-config 21 | - python3 22 | - python3-venv 23 | - wget 24 | 25 | On Arch/Manjaro, the following packages need to be installed: 26 | - base-devel 27 | 28 | Besides that, the [PSP toolchain](https://github.com/pspdev/psptoolchain) will need to be installed before installing this. 29 | 30 | ## Installation 31 | 1. Install the dependencies. 32 | 2. Make sure the environment variable ``$PSPDEV`` is set in your shell. Use ``echo $PSPDEV`` to confirm this. 33 | 3. If ``$PSPDEV`` is set to ``/usr/local/pspdev``, install with the following command: 34 | ``` 35 | sudo ./pacman-sudo.sh 36 | ``` 37 | If you've installed the PSP toolchain in a user writable location use: 38 | ``` 39 | ./pacman.sh 40 | ``` 41 | 42 | ## Usage 43 | 44 | Here is how to use ``psp-pacman`` and ``psp-makepkg``. 45 | 46 | ### Installing a package 47 | 48 | Installing a ``*.pkg.tar.gz`` package with a PSP library can be done with: 49 | ``` 50 | psp-pacman -U package-name-1.0.2.pkg.tar.gz 51 | ``` 52 | 53 | ### Building a package 54 | 55 | Building a package requires a ``PSPBUILD`` script. Here is [an example](https://git.archlinux.org/pacman.git/plain/proto/PKGBUILD.proto) and [some documentation on which options are available](https://wiki.archlinux.org/index.php/PKGBUILD). Do **not** call it ``PKGBUILD``, though, use ``PSPBUILD`` instead. Also make sure to install libraries in ``$pkgdir/psp/lib`` in your build script, since this will translate to ``$PSPDEV/psp/lib`` when installing. The architecure expected is mips. 56 | 57 | Packages can be build by running the following command in a directory with a PSPBUILD file in it: 58 | ``` 59 | psp-makepkg 60 | ``` 61 | 62 | This will create a file called something like ``package-name-1.0.2.pkg.tar.gz``. This file can be shared or installed. Installing would be done using the following command: 63 | ``` 64 | psp-pacman -U package-name-1.0.2.pkg.tar.gz 65 | ``` 66 | -------------------------------------------------------------------------------- /common.sh: -------------------------------------------------------------------------------- 1 | # Usage: extract 2 | function auto_extract 3 | { 4 | path=$1 5 | name=`echo $path|sed -e "s/.*\///"` 6 | ext=`echo $name|sed -e "s/.*\.//"` 7 | 8 | echo "Extracting $name..." 9 | 10 | case $ext in 11 | "tar"|"xz") tar --no-same-owner -xf $path ;; 12 | "gz"|"tgz") tar --no-same-owner -xzf $path ;; 13 | "bz2"|"tbz2") tar --no-same-owner -xjf $path ;; 14 | "zip") unzip $path ;; 15 | *) echo "I don't know how to extract $ext archives!"; return 1 ;; 16 | esac 17 | 18 | return $? 19 | } 20 | 21 | # Usage: download_and_extract URL DIRECTORY 22 | function download_and_extract 23 | { 24 | url=$1 25 | name=`echo $url|sed -e "s/.*\///"` 26 | outdir=$2 27 | 28 | # If there are already an extracted directory, delete it, otherwise 29 | # reapplying patches gets messy. I tried. 30 | [ -d $outdir ] && echo "Deleting old version of $outdir" && rm -rf $outdir 31 | 32 | # First, if the archive already exists, attempt to extract it. Failing 33 | # that, attempt to continue an interrupted download. If that also fails, 34 | # remove the presumably corrupted file. 35 | [ -f $name ] && auto_extract $name || { wget --continue --no-check-certificate $url -O $name || rm -f $name; } 36 | 37 | # If the file does not exist at this point, it means it was either never 38 | # downloaded, or it was deleted for being corrupted. Just go ahead and 39 | # download it. 40 | # Using wget --continue here would make buggy servers flip out for nothing. 41 | [ -f $name ] || wget --no-check-certificate $url -O $name && auto_extract $name 42 | 43 | # Switch to the newly created directory 44 | cd $outdir || return 1 45 | } 46 | 47 | function apply_patch { 48 | patch -p1 < "${BASE_PATH}/patches/$1.patch" 49 | } 50 | 51 | ## Install meson and ninja in the current directory using a venv 52 | function setup_build_system { 53 | python3 -m venv venv 54 | . venv/bin/activate 55 | pip install meson ninja 56 | } -------------------------------------------------------------------------------- /config/makepkg.conf: -------------------------------------------------------------------------------- 1 | #!/hint/bash 2 | # 3 | # ${PSPDEV}/pacman/share/etc/makepkg.conf 4 | # 5 | ######################################################################### 6 | # SOURCE ACQUISITION 7 | ######################################################################### 8 | # 9 | #-- The download utilities that makepkg should use to acquire sources 10 | # Format: 'protocol::agent' 11 | DLAGENTS=('file::/usr/bin/curl -gqC - -o %o %u' 12 | 'ftp::/usr/bin/curl -gqfC - --ftp-pasv --retry 3 --retry-delay 3 -o %o %u' 13 | 'http::/usr/bin/curl -gqb "" -fLC - --retry 3 --retry-delay 3 -o %o %u' 14 | 'https::/usr/bin/curl -gqb "" -fLC - --retry 3 --retry-delay 3 -o %o %u' 15 | 'rsync::/usr/bin/rsync --no-motd -z %u %o' 16 | 'scp::/usr/bin/scp -C %u %o') 17 | 18 | # Other common tools: 19 | # /usr/bin/snarf 20 | # /usr/bin/lftpget -c 21 | # /usr/bin/wget 22 | 23 | #-- The package required by makepkg to download VCS sources 24 | # Format: 'protocol::package' 25 | VCSCLIENTS=('bzr::bzr' 26 | 'git::git' 27 | 'hg::mercurial' 28 | 'svn::subversion') 29 | 30 | ######################################################################### 31 | # ARCHITECTURE, COMPILE FLAGS 32 | ######################################################################### 33 | # 34 | AR="psp-ar" 35 | RANLIB="psp-ranlib" 36 | CC="psp-gcc" 37 | CXX="psp-g++" 38 | CARCH="mips" 39 | CHOST="psp" 40 | 41 | #-- Compiler and Linker Flags 42 | #CPPFLAGS="" 43 | #CFLAGS="-O2 -pipe" 44 | #CXXFLAGS="-O2 -pipe" 45 | #LDFLAGS="" 46 | #-- Make Flags: change this for DistCC/SMP systems 47 | MAKEFLAGS="-j$(getconf _NPROCESSORS_ONLN)" 48 | #-- Debugging flags 49 | #DEBUG_CFLAGS="-g" 50 | #DEBUG_CXXFLAGS="-g" 51 | 52 | ######################################################################### 53 | # BUILD ENVIRONMENT 54 | ######################################################################### 55 | # 56 | # Defaults: BUILDENV=(!distcc !color !ccache check !sign) 57 | # A negated environment option will do the opposite of the comments below. 58 | # 59 | #-- distcc: Use the Distributed C/C++/ObjC compiler 60 | #-- color: Colorize output messages 61 | #-- ccache: Use ccache to cache compilation 62 | #-- check: Run the check() function if present in the PKGBUILD 63 | #-- sign: Generate PGP signature file 64 | # 65 | BUILDENV=(!distcc color !ccache check !sign) 66 | # 67 | #-- If using DistCC, your MAKEFLAGS will also need modification. In addition, 68 | #-- specify a space-delimited list of hosts running in the DistCC cluster. 69 | #DISTCC_HOSTS="" 70 | # 71 | #-- Specify a directory for package building. 72 | #BUILDDIR=/tmp/makepkg 73 | 74 | ######################################################################### 75 | # GLOBAL PACKAGE OPTIONS 76 | # These are default values for the options=() settings 77 | ######################################################################### 78 | # 79 | # Default: OPTIONS=(!strip docs libtool staticlibs emptydirs !zipman !purge !debug) 80 | # A negated option will do the opposite of the comments below. 81 | # 82 | #-- strip: Strip symbols from binaries/libraries 83 | #-- docs: Save doc directories specified by DOC_DIRS 84 | #-- libtool: Leave libtool (.la) files in packages 85 | #-- staticlibs: Leave static library (.a) files in packages 86 | #-- emptydirs: Leave empty directories in packages 87 | #-- zipman: Compress manual (man and info) pages in MAN_DIRS with gzip 88 | #-- purge: Remove files specified by PURGE_TARGETS 89 | #-- debug: Add debugging flags as specified in DEBUG_* variables 90 | # 91 | OPTIONS=(strip docs libtool staticlibs emptydirs zipman purge !debug) 92 | 93 | #-- File integrity checks to use. Valid: ck, md5, sha1, sha224, sha256, sha384, sha512, b2 94 | INTEGRITY_CHECK=(ck) 95 | #-- Options to be used when stripping binaries. See `man strip' for details. 96 | STRIP_BINARIES="--strip-all" 97 | #-- Options to be used when stripping shared libraries. See `man strip' for details. 98 | STRIP_SHARED="--strip-unneeded" 99 | #-- Options to be used when stripping static libraries. See `man strip' for details. 100 | STRIP_STATIC="--strip-debug" 101 | #-- Manual (man and info) directories to compress (if zipman is specified) 102 | MAN_DIRS=({usr{,/local}{,/share},opt/*}/{man,info}) 103 | #-- Doc directories to remove (if !docs is specified) 104 | DOC_DIRS=(usr/{,local/}{,share/}{doc,gtk-doc} opt/*/{doc,gtk-doc}) 105 | #-- Files to be removed from all packages (if purge is specified) 106 | PURGE_TARGETS=(usr/{,share}/info/dir .packlist *.pod) 107 | #-- Directory to store source code in for debug packages 108 | DBGSRCDIR="/usr/src/debug" 109 | 110 | ######################################################################### 111 | # PACKAGE OUTPUT 112 | ######################################################################### 113 | # 114 | # Default: put built package and cached source in build directory 115 | # 116 | #-- Destination: specify a fixed directory where all packages will be placed 117 | #PKGDEST=/home/packages 118 | #-- Source cache: specify a fixed directory where source files will be cached 119 | #SRCDEST=/home/sources 120 | #-- Source packages: specify a fixed directory where all src packages will be placed 121 | #SRCPKGDEST=/home/srcpackages 122 | #-- Log files: specify a fixed directory where all log files will be placed 123 | #LOGDEST=/home/makepkglogs 124 | #-- Packager: name/email of the person or organization building packages 125 | #PACKAGER="John Doe " 126 | #-- Specify a key to use for package signing 127 | #GPGKEY="" 128 | 129 | ######################################################################### 130 | # COMPRESSION DEFAULTS 131 | ######################################################################### 132 | # 133 | COMPRESSGZ=(gzip -c -f -n) 134 | COMPRESSBZ2=(bzip2 -c -f) 135 | COMPRESSXZ=(xz -c -z -) 136 | COMPRESSZST=(zstd -c -z -q -) 137 | COMPRESSLRZ=(lrzip -q) 138 | COMPRESSLZO=(lzop -q) 139 | COMPRESSZ=(compress -c -f) 140 | COMPRESSLZ4=(lz4 -q) 141 | COMPRESSLZ=(lzip -c -f) 142 | 143 | ######################################################################### 144 | # EXTENSION DEFAULTS 145 | ######################################################################### 146 | # 147 | PKGEXT='.pkg.tar.gz' 148 | SRCEXT='.src.tar.gz' 149 | -------------------------------------------------------------------------------- /config/pacman.conf: -------------------------------------------------------------------------------- 1 | # 2 | # # ${PSPDEV}/pacman/share/etc/pacman.conf 3 | # 4 | # See the pacman.conf(5) manpage for option and repository directives 5 | 6 | # 7 | # GENERAL OPTIONS 8 | # 9 | [options] 10 | # The following paths are commented out with their default values listed. 11 | # If you wish to use different paths, uncomment and update the paths. 12 | #RootDir = /usr/local/pspdev/psp 13 | #DBPath = /usr/local/pspdev/var/lib/pacman/ 14 | #CacheDir = /usr/local/pspdev/var/cache/pacman/pkg/ 15 | #LogFile = /usr/local/pspdev/var/log/pacman.log 16 | #GPGDir = /usr/local/pspdev/etc/pacman.d/gnupg/ 17 | #HookDir = /usr/local/pspdev/etc/pacman.d/hooks/ 18 | #HoldPkg = pacman glibc 19 | #XferCommand = /usr/bin/curl -L -C - -f -o %o %u 20 | #XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u 21 | #CleanMethod = KeepInstalled 22 | Architecture = mips 23 | 24 | # Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup 25 | #IgnorePkg = 26 | #IgnoreGroup = 27 | 28 | #NoUpgrade = 29 | #NoExtract = 30 | 31 | # Misc options 32 | #UseSyslog 33 | #Color 34 | #NoProgressBar 35 | #TotalDownload 36 | CheckSpace 37 | #VerbosePkgLists 38 | DisableDownloadTimeout 39 | 40 | # PGP signature checking 41 | #SigLevel = Optional 42 | #LocalFileSigLevel = Optional 43 | #RemoteFileSigLevel = Optional 44 | 45 | # 46 | # REPOSITORIES 47 | # - can be defined here or included from another file 48 | # - pacman will search repositories in the order defined here 49 | # - local/custom mirrors can be added here or in separate files 50 | # - repositories listed first will take precedence when packages 51 | # have identical names, regardless of version number 52 | # - URLs will have $repo replaced by the name of the current repo 53 | # - URLs will have $arch replaced by the name of the architecture 54 | # 55 | # Repository entries are of the format: 56 | # [repo-name] 57 | # Server = ServerName 58 | # Include = IncludePath 59 | # 60 | # The header [repo-name] is crucial - it must be present and 61 | # uncommented to enable the repo. 62 | # 63 | 64 | # An example of a disabled remote package repository with multiple servers 65 | # available. To enable, uncomment the following lines. You can add preferred 66 | # servers immediately after the header and they will be used before the 67 | # default mirrors. 68 | #[core] 69 | #SigLevel = Required 70 | #Server = ftp://ftp.example.com/foobar/$repo/os/$arch/ 71 | # The file referenced here should contain a list of 'Server = ' lines. 72 | #Include = /usr/local/pspdev/etc/pacman.d/mirrorlist 73 | 74 | # An example of a custom package repository. See the pacman manpage for 75 | # tips on creating your own repositories. 76 | #[custom] 77 | #SigLevel = Optional TrustAll 78 | #Server = file:///home/custompkgs 79 | 80 | [pspdev] 81 | SigLevel = Optional TrustAll 82 | Server = https://pspdev.github.io/psp-packages/ 83 | -------------------------------------------------------------------------------- /pacman-sudo.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # pacman-sudo.sh by Wouter Wijsman (wwijsman@live.nl) 3 | 4 | ## Enter the psp-pacman directory. 5 | cd "$(dirname "$0")" || { echo "ERROR: Could not enter the psp-pacman directory."; exit 1; } 6 | 7 | export PSPDEV=/usr/local/pspdev 8 | export PATH=$PATH:$PSPDEV/bin 9 | 10 | ## Run the pacman script. 11 | ./pacman.sh $@ || { echo "ERROR: Could not run the pacman script."; exit 1; } -------------------------------------------------------------------------------- /pacman.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # pacman.sh by Wouter Wijsman (wwijsman@live.nl) 3 | 4 | # Exit on errors 5 | set -e 6 | set -u 7 | 8 | ## Remove $CC and $CXX for configure 9 | unset CC 10 | unset CXX 11 | 12 | ## Enter the psp-pacman directory. 13 | cd "$(dirname "$0")" 14 | 15 | ## Load common functions 16 | source common.sh 17 | 18 | ## Variables used to build 19 | PACMAN_VERSION="6.0.1" 20 | INSTALL_DIR="${PSPDEV}/share/pacman" 21 | BASE_PATH="${PWD}" 22 | 23 | ## Prepare the build environment 24 | mkdir -p "${BASE_PATH}/build" 25 | cd "${BASE_PATH}/build" 26 | download_and_extract https://gitlab.archlinux.org/pacman/pacman/-/archive/v${PACMAN_VERSION}/pacman-v${PACMAN_VERSION}.tar.gz pacman-v${PACMAN_VERSION} 27 | 28 | ## Fix some lines in the scripts which have hardcoded paths 29 | find ./ -type f -name "*.in" -exec sed -i -e "s#LIBRARY=\${LIBRARY:-'@libmakepkgdir@'}#LIBRARY=\${LIBRARY:-\"\${PSPDEV}/share/makepkg\"}#g" {} \; 30 | find ./ -type f -name "*.in" -exec sed -i -e "s#declare -r confdir='@sysconfdir@'#declare -r confdir=\"\${PSPDEV}/etc\"#g" {} \; 31 | find ./ -type f -name "*.in" -exec sed -i -e "s#export TEXTDOMAINDIR='@localedir@'#export TEXTDOMAINDIR=\"\${PSPDEV}/share/locale\"#g" {} \; 32 | find ./ -type f -name "*.in" -exec sed -i -e 's#@libmakepkgdir@#${PSPDEV}/share/makepkg#g' {} \; 33 | 34 | ## Apply patch 35 | apply_patch pacman-${PACMAN_VERSION} 36 | 37 | ## Install meson and ninja in the current directory 38 | setup_build_system 39 | 40 | ## Build pacman 41 | meson build -Dprefix="${PSPDEV}" --buildtype=release \ 42 | -Ddefault_library=static -Dbuildscript=PSPBUILD \ 43 | -Dprefix="${PSPDEV}" -Dsysconfdir="${PSPDEV}/etc" -Dbindir="${PSPDEV}/share/pacman/bin" -Dlocalstatedir="${PSPDEV}/var" \ 44 | -Ddoc=disabled -Di18n=false 45 | cd build 46 | ninja 47 | 48 | ## Install 49 | ninja install 50 | 51 | ## Install configuration files and wrapper script 52 | cd "${BASE_PATH}" 53 | install -d "${PSPDEV}/etc/" 54 | install -m 644 config/pacman.conf "${PSPDEV}/etc/pacman.conf" 55 | install -m 644 config/makepkg.conf "${PSPDEV}/etc/makepkg.conf" 56 | install -d "${PSPDEV}/bin/" 57 | install -m 755 scripts/psp-pacman "${PSPDEV}/bin/psp-pacman" 58 | install -m 755 scripts/psp-makepkg "${PSPDEV}/bin/psp-makepkg" 59 | 60 | ## Make sure the dbpath directory exists 61 | mkdir -p "${PSPDEV}/var/lib/pacman" 62 | 63 | ## Store build information 64 | BUILD_FILE="${PSPDEV}/build.txt" 65 | if [[ -f "${BUILD_FILE}" ]]; then 66 | sed -i'' '/^psp-pacman /d' "${BUILD_FILE}" 67 | fi 68 | git log -1 --format="psp-pacman %H %cs %s" >> "${BUILD_FILE}" 69 | 70 | ## Done 71 | echo "psp-pacman installation finished." 72 | -------------------------------------------------------------------------------- /patches/pacman-6.0.1.patch: -------------------------------------------------------------------------------- 1 | diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c 2 | index f806e5b..fcd1bfc 100644 3 | --- a/lib/libalpm/add.c 4 | +++ b/lib/libalpm/add.c 5 | @@ -115,8 +115,7 @@ static int perform_extraction(alpm_handle_t *handle, struct archive *archive, 6 | { 7 | int ret; 8 | struct archive *archive_writer; 9 | - const int archive_flags = ARCHIVE_EXTRACT_OWNER | 10 | - ARCHIVE_EXTRACT_PERM | 11 | + const int archive_flags = ARCHIVE_EXTRACT_PERM | 12 | ARCHIVE_EXTRACT_TIME | 13 | ARCHIVE_EXTRACT_UNLINK | 14 | ARCHIVE_EXTRACT_XATTR | 15 | diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c 16 | index 299d287..90ae42c 100644 17 | --- a/lib/libalpm/util.c 18 | +++ b/lib/libalpm/util.c 19 | @@ -475,6 +475,12 @@ static int _alpm_chroot_write_to_child(alpm_handle_t *handle, int fd, 20 | } 21 | } 22 | 23 | +#if defined(__APPLE__) 24 | +#ifndef MSG_NOSIGNAL 25 | +#define MSG_NOSIGNAL SO_NOSIGPIPE 26 | +#endif 27 | +#endif 28 | + 29 | nwrite = send(fd, buf, *buf_size, MSG_NOSIGNAL); 30 | 31 | if(nwrite != -1) { 32 | diff --git a/meson.build b/meson.build 33 | index 76b9d2a..673324c 100644 34 | --- a/meson.build 35 | +++ b/meson.build 36 | @@ -41,12 +41,7 @@ if not have_bash 37 | error('bash >= 4.4.0 is required for pacman scripts.') 38 | endif 39 | 40 | -bashcompletion = dependency('bash-completion', required : false) 41 | -if bashcompletion.found() 42 | - BASHCOMPDIR = bashcompletion.get_pkgconfig_variable('completionsdir') 43 | -else 44 | - BASHCOMPDIR = join_paths(DATAROOTDIR, 'bash-completion/completions') 45 | -endif 46 | +BASHCOMPDIR = join_paths(DATAROOTDIR, 'bash-completion/completions') 47 | 48 | if get_option('use-git-version') 49 | PACKAGE_VERSION = run_command( 50 | @@ -175,7 +170,8 @@ foreach type : [ 51 | endif 52 | endforeach 53 | 54 | -if conf.has('HAVE_STRUCT_STATVFS_F_FLAG') 55 | +os = host_machine.system() 56 | +if conf.has('HAVE_STRUCT_STATVFS_F_FLAG') and not os.startswith('darwin') 57 | conf.set('FSSTATSTYPE', 'struct statvfs') 58 | elif conf.has('HAVE_STRUCT_STATFS_F_FLAGS') 59 | conf.set('FSSTATSTYPE', 'struct statfs') 60 | @@ -235,7 +231,6 @@ if file_seccomp.enabled() or ( file_seccomp.auto() and filever.version_compare(' 61 | filecmd = 'file -S' 62 | endif 63 | 64 | -os = host_machine.system() 65 | if os.startswith('darwin') 66 | inodecmd = '/usr/bin/stat -f \'%i %N\'' 67 | strip_binaries = '' 68 | diff --git a/scripts/libmakepkg/executable/strip.sh.in b/scripts/libmakepkg/executable/strip.sh.in 69 | index d4d53b9..5226fce 100644 70 | --- a/scripts/libmakepkg/executable/strip.sh.in 71 | +++ b/scripts/libmakepkg/executable/strip.sh.in 72 | @@ -30,8 +30,8 @@ executable_functions+=('executable_strip') 73 | 74 | executable_strip() { 75 | if check_option "strip" "y"; then 76 | - if ! type -p strip >/dev/null; then 77 | - error "$(gettext "Cannot find the %s binary required for object file stripping.")" "strip" 78 | + if ! type -p psp-strip >/dev/null; then 79 | + error "$(gettext "Cannot find the %s binary required for object file stripping.")" "psp-strip" 80 | return 1 81 | fi 82 | fi 83 | diff --git a/scripts/libmakepkg/tidy/strip.sh.in b/scripts/libmakepkg/tidy/strip.sh.in 84 | index 9660253..5c52ee0 100644 85 | --- a/scripts/libmakepkg/tidy/strip.sh.in 86 | +++ b/scripts/libmakepkg/tidy/strip.sh.in 87 | @@ -97,7 +97,7 @@ strip_file() { 88 | fi 89 | 90 | local tempfile=$(mktemp "$binary.XXXXXX") 91 | - if strip "$@" "$binary" -o "$tempfile"; then 92 | + if psp-strip "$@" "$binary" -o "$tempfile"; then 93 | cat "$tempfile" > "$binary" 94 | fi 95 | rm -f "$tempfile" 96 | @@ -107,7 +107,7 @@ strip_lto() { 97 | local binary=$1; 98 | 99 | local tempfile=$(mktemp "$binary.XXXXXX") 100 | - if strip -R .gnu.lto_* -R .gnu.debuglto_* -N __gnu_lto_v1 "$binary" -o "$tempfile"; then 101 | + if psp-strip -R .gnu.lto_* -R .gnu.debuglto_* -N __gnu_lto_v1 "$binary" -o "$tempfile"; then 102 | cat "$tempfile" > "$binary" 103 | fi 104 | rm -f "$tempfile" 105 | diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in 106 | index e58edfa..03a9709 100644 107 | --- a/scripts/makepkg.sh.in 108 | +++ b/scripts/makepkg.sh.in 109 | @@ -231,17 +231,6 @@ run_pacman() { 110 | else 111 | cmd=("$PACMAN_PATH" "${PACMAN_OPTS[@]}" "$@") 112 | cmdescape="$(printf '%q ' "${cmd[@]}")" 113 | - if (( ${#PACMAN_AUTH[@]} )); then 114 | - if in_array '%c' "${PACMAN_AUTH[@]}"; then 115 | - cmd=("${PACMAN_AUTH[@]/\%c/$cmdescape}") 116 | - else 117 | - cmd=("${PACMAN_AUTH[@]}" "${cmd[@]}") 118 | - fi 119 | - elif type -p sudo >/dev/null; then 120 | - cmd=(sudo "${cmd[@]}") 121 | - else 122 | - cmd=(su root -c "$cmdescape") 123 | - fi 124 | local lockfile="$(pacman-conf DBPath)/db.lck" 125 | while [[ -f $lockfile ]]; do 126 | local timer=0 127 | diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c 128 | index e398855..15b00de 100644 129 | --- a/src/pacman/pacman.c 130 | +++ b/src/pacman/pacman.c 131 | @@ -1131,7 +1131,8 @@ int main(int argc, char *argv[]) 132 | } 133 | 134 | /* check if we have sufficient permission for the requested operation */ 135 | - if(myuid > 0 && needs_root()) { 136 | + /* pspdev: since we always force a root dir, check write access */ 137 | + if(myuid > 0 && needs_root() && (access(config->rootdir, W_OK) != 0)) { 138 | pm_printf(ALPM_LOG_ERROR, _("you cannot perform this operation unless you are root.\n")); 139 | cleanup(EXIT_FAILURE); 140 | } 141 | diff --git a/scripts/libmakepkg/lint_package/dotfiles.sh.in b/scripts/libmakepkg/lint_package/dotfiles.sh.in 142 | index 0b993dd4..4c447bd0 100644 143 | --- a/scripts/libmakepkg/lint_package/dotfiles.sh.in 144 | +++ b/scripts/libmakepkg/lint_package/dotfiles.sh.in 145 | @@ -34,6 +34,7 @@ check_dotfiles() { 146 | shopt -s nullglob 147 | 148 | for f in "$pkgdir"/.*; do 149 | + [[ -e "${f}" ]] || continue 150 | [[ ${f##*/} == . || ${f##*/} == .. ]] && continue 151 | error "$(gettext "Dotfile found in package root '%s'")" "$f" 152 | ret=1 153 | -------------------------------------------------------------------------------- /scripts/psp-makepkg: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ## Make sure PSPDEV is set 4 | if [ -z "${PSPDEV}" ]; then 5 | echo "The PSPDEV environment variable has not been set" 6 | exit 1 7 | fi 8 | 9 | if [ ! -d "${PSPDEV}" ]; then 10 | echo "${PSPDEV} does not exist" 11 | exit 2 12 | fi 13 | 14 | ## Export makepkg variables 15 | export PACMAN=psp-pacman 16 | export MAKEPKG_CONF="${PSPDEV}/etc/makepkg.conf" 17 | 18 | ## Add the directory with pacman's binaries to the start of the PATH 19 | export PATH="${PSPDEV}/share/pacman/bin:${PATH}" 20 | 21 | ## Run makepkg 22 | makepkg "$@" 23 | -------------------------------------------------------------------------------- /scripts/psp-pacman: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ## Make sure PSPDEV is set 4 | if [ -z "${PSPDEV}" ]; then 5 | echo "The PSPDEV environment variable has not been set" 6 | exit 1 7 | fi 8 | 9 | if [ ! -d "${PSPDEV}" ]; then 10 | echo "${PSPDEV} does not exist" 11 | exit 2 12 | fi 13 | 14 | ## Use sudo if the current user doesn't own $PSPDEV 15 | if ! touch "${PSPDEV}" >/dev/null 2>&1; then 16 | sudo PSPDEV="${PSPDEV}" "$0" "$@" 17 | exit $? 18 | fi 19 | 20 | ## Add the directory with pacman's binaries to the start of the PATH 21 | export PATH="${PSPDEV}/share/pacman/bin:${PATH}" 22 | 23 | ## Run pacman and make sure to use the current PSPDEV 24 | pacman \ 25 | --root "${PSPDEV}" \ 26 | --dbpath "${PSPDEV}/var/lib/pacman" \ 27 | --config "${PSPDEV}/etc/pacman.conf" \ 28 | --cachedir "${PSPDEV}/var/cache/pacman/pkg" \ 29 | --gpgdir "${PSPDEV}/etc/pacman.d/gnupg/" \ 30 | --logfile "${PSPDEV}/var/log/pacman.log" \ 31 | --hookdir "${PSPDEV}/share/libalpm/hooks" \ 32 | --hookdir "${PSPDEV}/etc/pacman.d/hooks" \ 33 | "$@" 34 | --------------------------------------------------------------------------------