Skip to content

Conversation

@sharkwouter
Copy link
Member

@sharkwouter sharkwouter commented May 3, 2020

This PR adds a step to install the package manager psp-pacman for managing PSP libraries install in your $PSPDEV/psp directory. There is a patch and custom configuration in patches in this PR, but the changes are extremely minor. This is basically upstream pacman with some different build flags.

Differences from what you might be used to with pacman:

  • Only pacman and makgepkg are made available in $PSPDEV/bin with the use of wrappers called psp-pacman and psp-makepkg. The rest of the binaries is installed in $PSPDEV/share/pacman/bin. This directory is added to the path while psp-pacman and psp-makepkg are being used, but it's never added to the user's shell.
  • Instead of build files being called PKGBUILD, PSPBUILD is expected.
    -In packages and PSPBUILD files, $PSPDEV/ is /. This means psp-pacman can't do anything to the actual system files, so no harmful /broken packages will destroy your system.
  • Documentation files are not build, since they require extra dependencies and will reference the wrong commands (probably).
  • In PSPBUILDs and packages the arch has to be set to mips, since the PSP is mips. Any can also be used for system wide script files.
  • The patch makes the bash completion files install in $PSPDEV/etc/bash-completion instead of system wide. Users can copy them if they wish to use them, but they won't work without renaming them anyway.

I didn't update the README.md yet to include dependencies, since there is a change to that which will be merged soon which would cause a conflict. To clarify, this does add the following dependencies for Ubuntu/Debian:

  • m4
  • libarchive-dev
  • libcurl4-openssl-dev
  • libgpgme-dev
  • libssl-dev
  • pkg-config
  • python3
  • python3-venv

Building without libcurl4-openssl-dev is possible, but would require the configuration file to be changed to use wget instead. This package is only 250 kb, though, so that's probably not worth it.

Where should I document how to use this? I now have one example PSPBUILD to test with set up in another repo: https://github.com/sharkwouter/psp-packages

I have not tested setting up a repository yet, we should set one up in the future.

PS, please squish this when merged. The commit history is a mess because of experimentation.

Edit: Updated dependencies and list of changes to reflect current state of psp-pacman.

@sharkwouter
Copy link
Member Author

This could be a solution for pspdev/psplibraries#50 and can help in resolving pspdev/psplibraries#51.

@sharkwouter
Copy link
Member Author

pspdev/pspdev-docker#10 is related to this PR.

@sharkwouter
Copy link
Member Author

Somehow I hadn't pushed the change which fixes the paths to the patches yet. Now I've tested it again and it installs like expected

@sharkwouter
Copy link
Member Author

it also installs bash completion files, but since the packages are renamed that may not be useful right now.

@sharkwouter
Copy link
Member Author

I've found another problem with the installation. If it is already installed, the install command will fail. This is because it can't overwrite the autocompletion files.

@sharkwouter sharkwouter marked this pull request as draft May 5, 2020 22:35
@sharkwouter
Copy link
Member Author

I've converted this PR to a draft for now since it has the following problems still unfixed:

  • Wrapper scripts are installed instead of the real ones.
  • The bash completion files are incorrectly named.
  • The installation fails if the bash completion files are already installed.
  • It does not update the readme with the required dependencies.
  • It uses autotools for building, which has been deprecated by upstream. Meson should be used instead.

I will be able to work on this on the weekend, I can't really give any garantees befofe then. My plan is to see if I can modify the meson configuration files to hopefully solve these issues and try to see if upstream would accept those changes. Help or feedback on this approach is welcome.

@carstene1ns
Copy link
Member

There are some problems with the current approach unfortunately:

  • pacman cannot be built this way on every platform we support (windows, macos)
  • some linux distributions (arch, fedora, gentoo, …) already ship native pacman, so need no building (better integration, updates)

For macos we can provide an own binary without much trouble, under windows we can utilize msys2, as it is maintained with a series of patches already.
We can check if the user is running a distribution known to having pacman and tell them to install it in a dependency script.

There is no need to patch pacman too much, a set of wrapper scripts can do all we need. For example psp-makepkg:

#!/bin/bash
export PACMAN=psp-pacman
export MAKEPKG_CONF=$(psp-config --pspdev-path)/pacman/makepkg.conf
makepkg -p PSPBUILD "$@"

And psp-pacman:

#!/bin/bash
pacman --config $(psp-config --pspdev-path)/pacman/pacman.conf "$@"

@sharkwouter
Copy link
Member Author

sharkwouter commented May 7, 2020

As per our Discord conversation, I'll try to make the following changes in the coming days:

  • Create an installation script which only builds pacman if needed, but always installs the configuration files and wrappers
  • Make wrappers for the commands pacman and makepkg (I'm going to assume other commands are not needed)
  • Put this with the patch I have all in one repo called psp-pacman
  • Transfer ownership to pspdev
  • Make the psptoolchain install it

Besides these things, the following will also need to be done, but either can't be done by me or should be done after the previously mentioned things:

  • Create a patch file for building on Mac (Need help)
  • Make the repo pspdev/psp-pacman (Need help)
  • Make pacman build statically (This is hard, might need help, not as high prio as the things above and might not be needed)
  • Testing (Will need help with this once the pspdev/psp-pacman repo is up)
  • Create README (Should be finished after everything else)
  • Update README of psptoolchain (Should be done after everything else)

There is probably more, but these seem like most of the important bits.

@sharkwouter
Copy link
Member Author

Most of the work which was required has been done. It can be found in this repository: https://github.com/sharkwouter/psp-pacman

Some notes on how it works:

  • It only adds the scripts psp-pacman and psp-makepkg to $PSPDEV/bin, the rest of the binaries which were compiled will stay out of your PATH.
  • Pacman is only build and installed if it doesn't exist yet.
  • The psp-pacman script will use sudo if needed. This is required for it to work on a system wide installation on Ubuntu/Debian without making modifications to your sudoers file.
  • The system's pacman is used if available.

Could you set up an empty repo called pspdev/psp-pacman so I can make a PR there and use that repo for this PR?

@sharkwouter
Copy link
Member Author

Btw, #114 will need to be merged before this PR.

@sharkwouter
Copy link
Member Author

I've now tested and fixed https://github.com/sharkwouter/psp-pacman for Arch. It should now also work on other systems which already have pacman installed.

One issue on Arch, which I'm not seeing on Debian, is that stripping fails.

@sharkwouter
Copy link
Member Author

I have now removed almost all of the logic from this PR. It now instead uses the psp-pacman repo. Once pspdev/psp-pacman#1 has been merged, it should work.

@carstene1ns carstene1ns marked this pull request as ready for review May 12, 2020 20:13
@sharkwouter
Copy link
Member Author

sharkwouter commented May 13, 2020

The README has been updated with the dependencies for this. We might want to wait with merging this until this issue with installing .pc files has been resolved: pspdev/psp-pacman#1 (comment)

@carstene1ns
Copy link
Member

Applied this in https://github.com/pspdev/pspdev.

@sharkwouter sharkwouter deleted the psp-pacman branch November 17, 2021 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants