Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add libgit2 #342

Merged
merged 1 commit into from
Dec 21, 2023
Merged

add libgit2 #342

merged 1 commit into from
Dec 21, 2023

Conversation

jeroen
Copy link
Contributor

@jeroen jeroen commented Dec 20, 2023

Relatively small lib to support the gert package and perhaps others:

configure: sh -c "./configure.orig --build=x86_64-pc-linux-gnu --host=wasm32-unknown-emscripten"

Found pkg-config cflags and libs!
Using PKG_CFLAGS=-sUSE_ZLIB=1 -I/opt/webr/wasm/include
Using PKG_LIBS=-L/opt/webr/wasm/lib -lgit2 -lrt -sUSE_ZLIB=1
Configuration OK!
** libs
using C compiler: 'emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.47 (431685f05c67f0424c11473cc16798b9587bb536)'
rm -f gert.so branch.o clone.o commit.o config.o conflicts.o files.o ignore.o init.o merge.o rebase.o stash.o submodules.o tag.o utils.o version.o
emcc -DNDEBUG -sUSE_ZLIB=1 -I/opt/webr/wasm/include -DR_NO_REMAP -DSTRICT_R_HEADERS  -I/opt/webr/wasm/include -I/opt/webr/R/build/R-4.3.0/build/include -I/opt/webr/R/build/R-4.3.0/src/include -s USE_BZIP2=1 -s USE_ZLIB=1 -fvisibility=hidden -fpic  -Oz -fPIC -fwasm-exceptions -s SUPPORT_LONGJMP=wasm -std=gnu11 -c branch.c -o branch.o
emcc -DNDEBUG -sUSE_ZLIB=1 -I/opt/webr/wasm/include -DR_NO_REMAP -DSTRICT_R_HEADERS  -I/opt/webr/wasm/include -I/opt/webr/R/build/R-4.3.0/build/include -I/opt/webr/R/build/R-4.3.0/src/include -s USE_BZIP2=1 -s USE_ZLIB=1 -fvisibility=hidden -fpic  -Oz -fPIC -fwasm-exceptions -s SUPPORT_LONGJMP=wasm -std=gnu11 -c clone.c -o clone.o
emcc -DNDEBUG -sUSE_ZLIB=1 -I/opt/webr/wasm/include -DR_NO_REMAP -DSTRICT_R_HEADERS  -I/opt/webr/wasm/include -I/opt/webr/R/build/R-4.3.0/build/include -I/opt/webr/R/build/R-4.3.0/src/include -s USE_BZIP2=1 -s USE_ZLIB=1 -fvisibility=hidden -fpic  -Oz -fPIC -fwasm-exceptions -s SUPPORT_LONGJMP=wasm -std=gnu11 -c commit.c -o commit.o
emcc -DNDEBUG -sUSE_ZLIB=1 -I/opt/webr/wasm/include -DR_NO_REMAP -DSTRICT_R_HEADERS  -I/opt/webr/wasm/include -I/opt/webr/R/build/R-4.3.0/build/include -I/opt/webr/R/build/R-4.3.0/src/include -s USE_BZIP2=1 -s USE_ZLIB=1 -fvisibility=hidden -fpic  -Oz -fPIC -fwasm-exceptions -s SUPPORT_LONGJMP=wasm -std=gnu11 -c config.c -o config.o
emcc -DNDEBUG -sUSE_ZLIB=1 -I/opt/webr/wasm/include -DR_NO_REMAP -DSTRICT_R_HEADERS  -I/opt/webr/wasm/include -I/opt/webr/R/build/R-4.3.0/build/include -I/opt/webr/R/build/R-4.3.0/src/include -s USE_BZIP2=1 -s USE_ZLIB=1 -fvisibility=hidden -fpic  -Oz -fPIC -fwasm-exceptions -s SUPPORT_LONGJMP=wasm -std=gnu11 -c conflicts.c -o conflicts.o
emcc -DNDEBUG -sUSE_ZLIB=1 -I/opt/webr/wasm/include -DR_NO_REMAP -DSTRICT_R_HEADERS  -I/opt/webr/wasm/include -I/opt/webr/R/build/R-4.3.0/build/include -I/opt/webr/R/build/R-4.3.0/src/include -s USE_BZIP2=1 -s USE_ZLIB=1 -fvisibility=hidden -fpic  -Oz -fPIC -fwasm-exceptions -s SUPPORT_LONGJMP=wasm -std=gnu11 -c files.c -o files.o
emcc -DNDEBUG -sUSE_ZLIB=1 -I/opt/webr/wasm/include -DR_NO_REMAP -DSTRICT_R_HEADERS  -I/opt/webr/wasm/include -I/opt/webr/R/build/R-4.3.0/build/include -I/opt/webr/R/build/R-4.3.0/src/include -s USE_BZIP2=1 -s USE_ZLIB=1 -fvisibility=hidden -fpic  -Oz -fPIC -fwasm-exceptions -s SUPPORT_LONGJMP=wasm -std=gnu11 -c ignore.c -o ignore.o
emcc -DNDEBUG -sUSE_ZLIB=1 -I/opt/webr/wasm/include -DR_NO_REMAP -DSTRICT_R_HEADERS  -I/opt/webr/wasm/include -I/opt/webr/R/build/R-4.3.0/build/include -I/opt/webr/R/build/R-4.3.0/src/include -s USE_BZIP2=1 -s USE_ZLIB=1 -fvisibility=hidden -fpic  -Oz -fPIC -fwasm-exceptions -s SUPPORT_LONGJMP=wasm -std=gnu11 -c init.c -o init.o
emcc -DNDEBUG -sUSE_ZLIB=1 -I/opt/webr/wasm/include -DR_NO_REMAP -DSTRICT_R_HEADERS  -I/opt/webr/wasm/include -I/opt/webr/R/build/R-4.3.0/build/include -I/opt/webr/R/build/R-4.3.0/src/include -s USE_BZIP2=1 -s USE_ZLIB=1 -fvisibility=hidden -fpic  -Oz -fPIC -fwasm-exceptions -s SUPPORT_LONGJMP=wasm -std=gnu11 -c merge.c -o merge.o
emcc -DNDEBUG -sUSE_ZLIB=1 -I/opt/webr/wasm/include -DR_NO_REMAP -DSTRICT_R_HEADERS  -I/opt/webr/wasm/include -I/opt/webr/R/build/R-4.3.0/build/include -I/opt/webr/R/build/R-4.3.0/src/include -s USE_BZIP2=1 -s USE_ZLIB=1 -fvisibility=hidden -fpic  -Oz -fPIC -fwasm-exceptions -s SUPPORT_LONGJMP=wasm -std=gnu11 -c rebase.c -o rebase.o
emcc -DNDEBUG -sUSE_ZLIB=1 -I/opt/webr/wasm/include -DR_NO_REMAP -DSTRICT_R_HEADERS  -I/opt/webr/wasm/include -I/opt/webr/R/build/R-4.3.0/build/include -I/opt/webr/R/build/R-4.3.0/src/include -s USE_BZIP2=1 -s USE_ZLIB=1 -fvisibility=hidden -fpic  -Oz -fPIC -fwasm-exceptions -s SUPPORT_LONGJMP=wasm -std=gnu11 -c stash.c -o stash.o
emcc -DNDEBUG -sUSE_ZLIB=1 -I/opt/webr/wasm/include -DR_NO_REMAP -DSTRICT_R_HEADERS  -I/opt/webr/wasm/include -I/opt/webr/R/build/R-4.3.0/build/include -I/opt/webr/R/build/R-4.3.0/src/include -s USE_BZIP2=1 -s USE_ZLIB=1 -fvisibility=hidden -fpic  -Oz -fPIC -fwasm-exceptions -s SUPPORT_LONGJMP=wasm -std=gnu11 -c submodules.c -o submodules.o
emcc -DNDEBUG -sUSE_ZLIB=1 -I/opt/webr/wasm/include -DR_NO_REMAP -DSTRICT_R_HEADERS  -I/opt/webr/wasm/include -I/opt/webr/R/build/R-4.3.0/build/include -I/opt/webr/R/build/R-4.3.0/src/include -s USE_BZIP2=1 -s USE_ZLIB=1 -fvisibility=hidden -fpic  -Oz -fPIC -fwasm-exceptions -s SUPPORT_LONGJMP=wasm -std=gnu11 -c tag.c -o tag.o
emcc -DNDEBUG -sUSE_ZLIB=1 -I/opt/webr/wasm/include -DR_NO_REMAP -DSTRICT_R_HEADERS  -I/opt/webr/wasm/include -I/opt/webr/R/build/R-4.3.0/build/include -I/opt/webr/R/build/R-4.3.0/src/include -s USE_BZIP2=1 -s USE_ZLIB=1 -fvisibility=hidden -fpic  -Oz -fPIC -fwasm-exceptions -s SUPPORT_LONGJMP=wasm -std=gnu11 -c utils.c -o utils.o
emcc -DNDEBUG -sUSE_ZLIB=1 -I/opt/webr/wasm/include -DR_NO_REMAP -DSTRICT_R_HEADERS  -I/opt/webr/wasm/include -I/opt/webr/R/build/R-4.3.0/build/include -I/opt/webr/R/build/R-4.3.0/src/include -s USE_BZIP2=1 -s USE_ZLIB=1 -fvisibility=hidden -fpic  -Oz -fPIC -fwasm-exceptions -s SUPPORT_LONGJMP=wasm -std=gnu11 -c version.c -o version.o
emcc -s SIDE_MODULE=1 -s WASM_BIGINT -s ASSERTIONS=1 -L/opt/webr/wasm/lib -L/opt/webr/wasm/R-4.3.0/lib/R/lib -s USE_BZIP2=1 -s USE_ZLIB=1 -fwasm-exceptions -s SUPPORT_LONGJMP=wasm -Oz -o gert.so branch.o clone.o commit.o config.o conflicts.o files.o ignore.o init.o merge.o rebase.o stash.o submodules.o tag.o utils.o version.o -L/opt/webr/wasm/lib -lgit2 -lrt -sUSE_ZLIB=1
installing to /tmp/RtmpyJiunL/file4075627f70bf/gert/libs
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
*** copying figures
** building package indices
** installing vignettes
* creating tarball
packaged installation of 'gert' as 'gert_2.0.1_R_x86_64-pc-linux-gnu.tar.gz'
* DONE (gert)
Packaging: gert_2.0.1.data

@jeroen
Copy link
Contributor Author

jeroen commented Dec 21, 2023

Deployed this on R-universe and confirm that it works.

install.packages('gert', repos = sprintf('https://%s.r-universe.dev', c('ropensci', 'cran')))

library(gert)
writeLines("Test", "test.txt")
gert::git_init()
gert::git_add("test.txt")
gert::git_status()
git_config_set("user.name", "Jerry")
git_config_set("user.email", "[email protected]")
gert::git_commit("first commit")
gert::git_log()
gert

@georgestagg georgestagg merged commit b83a685 into r-wasm:main Dec 21, 2023
2 of 3 checks passed
@jeroen jeroen deleted the libgit2 branch December 21, 2023 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants