holepunchto / hypercore

Hypercore is a secure, distributed append-only log.
https://docs.holepunch.to
MIT License
2.57k stars 183 forks source link

Installation on OpenBSD #377

Open 4c656554 opened 1 year ago

4c656554 commented 1 year ago

Below is a command line (ksh) procedure for installing hypercore on OpenBSD 7.3 amd64:

pkg_add git
pkg_add libsodium
pkg_add libtool
pkg_add autoconf
pkg_add node
npm install node-gyp -g
export CFLAGS="-mssse3 -msse4.1"
export CXXFLAGS="-mssse3 -msse4.1"
mkdir proj
npm init proj
git clone --recursive --branch main https://github.com/4c656554/fs-native-extensions
cd fs*
node-gyp rebuild
npm run test
npm install -g
cd ..

git clone --recursive --branch master https://github.com/sodium-friends/sodium-native
cd sodium-native
npm link fs-native-extensions
node-gyp rebuild
npm run test
echo "Expect 90 test failures, this is ok for hypercore install"
npm install -g
cd ..

git clone --recursive --branch master https://github.com/sodium-friends/sodium-universal
cd sodium-universal
npm link sodium-native
npm link fs-native-extensions
npm install
npm install -g
cd ..

git clone --recursive --branch master https://github.com/holepunchto/hypercore
cd hypercore
npm link sodium-universal
npm link sodium-native
npm link fs-native-extensions
npm install
npm install -g
npm run test

All hypercore tests pass :-)

The simple npm install hypercore fails due to build issues in the fs-native-extensions dependency. (PR fix here ). Also related; this issue.

Wondering if anyone can see an easier way of doing the above, or if there is something obvious I missed?

4c656554 commented 1 year ago

I had a couple of transcription errors in the above script. This is what works:

pkg_add git
pkg_add libsodium
pkg_add libtool
pkg_add autoconf-2.71
pkg_add node
npm install node-gyp -g 
export CFLAGS="-mssse3 -msse4.1"
export CXXFLAGS="-mssse3 -msse4.1"
export C=clang
export CXX=clang++
npm install -g napi-macros
npm install -g node-gyp-build

git clone --recursive --branch main https://github.com/4c656554/fs-native-extensions
cd fs*
node-gyp rebuild
npm run test
npm install -g
cd ..

git clone --recursive --branch master https://github.com/sodium-friends/sodium-native
cd sodium-native
npm link fs-native-extensions
node-gyp rebuild
//npm run test
echo "Expect 90 test failures, this is ok for hypercore install"
npm install -g
cd ..

git clone --recursive --branch master https://github.com/sodium-friends/sodium-universal
cd sodium-universal
npm link sodium-native
npm link fs-native-extensions
echo 'installing sodium-universal'
npm install
npm install -g
cd ..

git clone --recursive --branch main https://github.com/holepunchto/hypercore
cd hypercore
npm link sodium-universal
npm link sodium-native
npm link fs-native-extensions
echo 'Installing hypercore...'
npm install
npm install -g
npm run test
4c656554 commented 7 months ago

Since version 10.17.0 : --omit=dev flags are needed on the npm installs and most npm links in the above. This is because the build of the dev dependency udx-native fails (added 10.17.0). This means the testing capability is lost though so the npm run test must also be dropped. Confirmed for OpenBSD 7.4.

It's possible a similar approach to the above could work for udx-native but I've not had time to try that yet.