paragonie / sodium_compat

Pure PHP polyfill for ext/sodium
https://paragonie.com
ISC License
895 stars 64 forks source link

Build of sodium-compat.phar fails #158

Closed bafta-benj closed 7 months ago

bafta-benj commented 1 year ago

Trying to run build-phar.sh on Amazon linux 2 fails thus...

...
Writing lock file
Installing dependencies from lock file
Package operations: 1 install, 0 updates, 0 removals
  - Installing paragonie/random_compat (v9.99.100): Extracting archive
9 package suggestions were added by new dependencies, use `composer suggest` to see details.
Package phpunit/php-token-stream is abandoned, you should avoid using it. No replacement was suggested.
Generating autoload files
pwd
/home/user/sodium_compat/dist/worktree
if [ ! -d dist ]; then mkdir dist; fi
if [ ! -f dist/box.json ]; then cp ../dist/box.json dist/box.json; fi
cp: cannot stat ‘../dist/box.json’: No such file or directory
make[1]: *** [sodium-compat.phar] Error 1

Note: the pwd in the above is my debug. As far as I can see there is a bug in dist/Makefile When it is in the directory sodium_compat/dist/worktree it tries to copy ../dist/box.json which will resolve to sodium_compat/dist/dist/box.json which is clearly wrong

Here is the patch I used to fix it...

diff --git a/dist/Makefile b/dist/Makefile
index 1678e12..64a1e11 100644
--- a/dist/Makefile
+++ b/dist/Makefile
@@ -31,7 +31,7 @@ clean:

 sodium-compat.phar: dist/box.json composer.lock
        if [ ! -d dist ]; then mkdir dist; fi
-       if [ ! -f dist/box.json ]; then cp ../dist/box.json dist/box.json; fi
+       if [ ! -f dist/box.json ]; then cp ../box.json dist/box.json; fi
        cp dist/box.json .
        php -d phar.readonly=0 $(box) build -c box.json -v