Forked from samp-node
- Used to work with infernus.
- Update
Node.js
to v22.17.0.- Inspector cannot use anymore.
- Only
entry_file
is used,resource
config are removed. - Removed
samp.fire
to avoid crashes. - Updated github workflows.
- Building based on
ubuntu-latest
means you may need a higher version of glibc.
- Building based on
git clone https://github.com/dockfries/samp-node
# or ssh
# git clone git@github.com:dockfries/samp-node.git
cd samp-node
git submodule update --init
for sh
./build.sh linux 2.6.1
./build.sh windows 2.6.1
for powershell
.\build.ps1 -Platform linux -PluginVersion 2.6.1
.\build.ps1 -Platform windows -PluginVersion 2.6.1
example v20.x
- delete everything under
deps/node/include
. - download
node-v20.19.3-headers.tar.gz
. - decompress and copy everything under
node/v20.19.3/include/node
todeps/node/include
.
git clone https://github.com/nodejs/node.git -b v20.x --depth 1
cd node
.\vcbuild x86 dll openssl-no-asm
cd out/Release # so you can get the libnode.dll & libnode.lib, windows need this two files.
- You need to install docker first.
- Create a normal user and set up home directories and passwd.
- Add this user to the docker group.
sudo usermod -aG docker YOUR_NORMAL_USERNAME
We use unofficial-builds build x86, which build symbols without the c++11_ABI, see
CMakeLists.txt
line 54.
su YOUR_NORMAL_USERNAME
/bin/bash
rm -fr ~/Devel/unofficial-builds-home
mkdir -p ~/Devel/unofficial-builds-home
cd ~/Devel/unofficial-builds-home
git clone https://github.com/nodejs/unofficial-builds
cd ~/Devel/unofficial-builds-home/unofficial-builds
vim ./recipes/x86/run.sh
# before: config_flags=--openssl-no-asm
# after: config_flags="--openssl-no-asm --shared"
bin/local_build.sh -r x86 -v v20.19.3 # for example 20.19.3, don't forget startWith 'v'
cp ~/Devel/unofficial-builds-home/staging/release/v20.19.3/node-v20.19.3-linux-x86.tar.gz /tmp
su YOUR_SUDO_USER
mv /tmp/node-v20.19.3-linux-x86.tar.gz ~
# use anything like shell/sftp download this file
# decompress it, you can see libnode.so.xxx in lib folder, that's what you need only.
after that, for local build samp-node, pls put your libnode into deps/node/lib/Release/win
and deps/node/lib/Release/linux
respectively.
for build samp-node, see .github/workflows/build.yml
.
Please refer to the previous version, but there are some differences.
-
Download Node.js headers and place them in
deps/node/include
directory. Then locatev8-typed-array.h
and add#undef max
before:#undef max static constexpr size_t kMaxByteLength = std::numeric_limits<int>::max();
-
Find
deps/v8/src/compiler/backend/ia32/instruction-selector-ia32.cc
in Node.js source code and replace globally:using node_t = Adapter::node_t
with:
using node_t = typename Adapter::node_t
-
compilation as before.
-
Clone from our forked unofficial repository (not the original one), then follow similar steps as above.
-
Execute:
bin/local_build.sh -r x86_22 -v v22.17.0
Note: Use
x86_22
instead ofx86
for-r
parameter
For version 22,.so
files end with127
- Damo for his samp.js project. 80% of native caller code is from that project, cause I didn't want to do all the args processing by myself when there's already something useful out there!
- Hual for some v8 tips he gave me
- Graber for a few suggestions and helpful advices
- pkfln (peek) for fixing and adding some samp callbacks/events in samp-node, and making @sa-mp/node
- polygxn for his changes in README.md which don't exist anymore
- JustMichael (ADRFranklin) for his contributions, including fixes, features, and any others he's going to do in future
- Alexander Plutalov (plutalov) for fixing long time crash issues and not having context running properly
- iAmir (Amyr Aahmady)