Skip to content

Build Node.js shared library for Android and Desktop

Notifications You must be signed in to change notification settings

linroid/libnode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

libnode

Build v16.14.0

Build Node.js shared library for multiple platforms

Build from source

  • Prepare build environment

    macOS:

    brew install coreutils

    Ubuntu:

    apt-get install python g++ gcc make gcc-multilib g++-multilib lib32z1 -y
  • Download the Node.js source code

    git clone https://github.com/nodejs/node.git
    cd node
    git checkout v16.7.0
  • Apply patches for knode

    ./scripts/patch.sh apply
  • Start building, get some ☕️:

    ./build.sh

After build successfully, all the artifacts are under artifacts directory

Upgrade Node.js

cd node
  • Stash changes:
    git stash
    
  • Switch to newer Node.js
    git fetch origin
    git checkout vxx.xx.x
    
  • Apply the changes and resolve conflicts
    git stash pop
    

Modify Node.js

Build scripts in this repository use patch files(under the patches directory) to apply changes for Node.js, so the Node.js upgrade work can be easier and it is intuitive to know what changes we've made.

If you need to do some changes in node's codebase, you should generate patches files and commit *.patch files instead of commiting changes directly.

Before doing your change, make sure your local changes is up-to-date:

git pull origin main
# your local changes under `node` directory will be dropped
./scripts/patch.sh apply -f

Now you can edit any files in Node.js under the node directory, to commit your changes, you need to update the patch files:

./scripts/patch.sh generate