Skip to content
This repository was archived by the owner on Jul 21, 2025. It is now read-only.

dockfries/samp-node

 
 

Repository files navigation

samp-node

Forked from samp-node

Changes in this fork

  • 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.

How to build x86 libnode for samp-node

NodeHeaders

example v20.x(20.19.3 now)

download here.

  1. delete everything under deps/node/include.
  2. download node-v20.19.3-headers.tar.gz.
  3. decompress and copy everything under node/v20.19.3/include/node to deps/node/include.

Windows20

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.

Linux20

  1. You need to install docker first.
  2. Create a normal user and set up home directories and passwd.
  3. Add this user to the docker group.
    1. 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.

Windows22

Please refer to the previous version, but there are some differences.

  1. Download Node.js headers and place them in deps/node/include directory. Then locate v8-typed-array.h and add #undef max before:

    #undef max
    static constexpr size_t kMaxByteLength = std::numeric_limits<int>::max();
  2. 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
  3. compilation as before.

Linux22

  1. Clone from our forked unofficial repository (not the original one), then follow similar steps as above.

  2. Execute:

    bin/local_build.sh -r x86_22 -v v22.17.0

    Note: Use x86_22 instead of x86 for -r parameter
    For version 22, .so files end with 127

About

Legacy sa-mp plugin to run node.js scripts.

Resources

Stars

Watchers

Forks

Languages

  • C++ 91.4%
  • CMake 7.8%
  • Other 0.8%