Skip to content
This repository was archived by the owner on Aug 29, 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.

Api

check here

How to build x86 samp-node with docker

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

How to build x86 libnode for samp-node

NodeHeaders

example v20.x

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

Credits

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

About

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

Resources

Stars

Watchers

Forks

Languages

  • C++ 89.3%
  • CMake 7.6%
  • PowerShell 1.4%
  • Shell 1.4%
  • Pawn 0.3%