From 45a751eee767d6a73c1690a8468b2028fda2ff7b Mon Sep 17 00:00:00 2001 From: gogo Date: Tue, 30 Jan 2024 21:11:33 +0100 Subject: [PATCH] fix --- apps/freenet-email-app/Makefile | 4 -- build-all.sh | 4 +- build-examples.sh | 4 ++ docs/src/install.md | 92 ++++++++++++++++++++++++++++- modules/antiflood-tokens/Cargo.lock | 22 +++---- 5 files changed, 106 insertions(+), 20 deletions(-) create mode 100644 build-examples.sh diff --git a/apps/freenet-email-app/Makefile b/apps/freenet-email-app/Makefile index 8a432d508..c40e8575b 100644 --- a/apps/freenet-email-app/Makefile +++ b/apps/freenet-email-app/Makefile @@ -19,10 +19,6 @@ IDENTITY_DELEGATE := $(FREENET_ROOT)$(PATH_SEP)modules$(PATH_SEP)identity-manage WEB_DIR_SRC := $(ROOT)$(PATH_SEP)web$(PATH_SEP)src FILE := $(IDENTITY_DELEGATE)$(PATH_SEP)build$(PATH_SEP)identity-manager-key.private.pem -IDENTITY_DELEGATE_PRIVATE_KEY := identity-manager-key.private.pem -PATH_TO_IDENTITY_DELEGATE := $(IDENTITY_DELEGATE)/build/$(IDENTITY_DELEGATE_PRIVATE_KEY) - - ifeq ($(CARGO_TARGET_DIR),) $(error CARGO_TARGET_DIR is not set) endif diff --git a/build-all.sh b/build-all.sh index b1f09a34d..49653f31a 100644 --- a/build-all.sh +++ b/build-all.sh @@ -30,6 +30,4 @@ cargo install --path crates/core --force && cargo install --path crates/fdev --force && cd ./modules/identity-management/ && make build && cd ../antiflood-tokens/ && rm Cargo.lock ; make build && -cd ../../ && -make -C ./apps/freenet-microblogging build && -make -C ./apps/freenet-email-app build +cd ../../ diff --git a/build-examples.sh b/build-examples.sh new file mode 100644 index 000000000..6447d7f0e --- /dev/null +++ b/build-examples.sh @@ -0,0 +1,4 @@ +cd ./apps/freenet-microblogging && make build && +cd ../.. +cd ./apps/freenet-email-app && make build && +cd ../.. diff --git a/docs/src/install.md b/docs/src/install.md index 37b99fc61..f2f557b56 100644 --- a/docs/src/install.md +++ b/docs/src/install.md @@ -1,4 +1,4 @@ -# Build freenet from source On Linux: +# Build freenet from source on Linux: There is a single line command to build all freenet on Linux. @@ -6,9 +6,97 @@ There is a single line command to build all freenet on Linux. git clone https://github.com/freenet/freenet-core && .\build-all.sh ``` +then you could test it by building and deploying any web application: -or +``` +.\build-examples.sh +``` +. + + +# Build freenet from source on Linux from command line: + +You could also run this: ```bash wget https://sh.rustup.rs ; sh index.html -y && source "$HOME/.cargo/env" && rustup default stable && rustup target add wasm32-unknown-unknown && (sh curl -L https://git.io/n-install | bash) ; ~/n/bin/n latest ; ~/n/bin/npm install -g typescript webpack && git clone https://github.com/freenet/freenet-core/ && cd freenet-core && git submodule update --init --recursive && export CARGO_TARGET_DIR="$(pwd)/target" && cd stdlib/typescript/ && npm run dev.package && cd ../.. && cargo install --path crates/core --force && cargo install --path crates/fdev --force && cd ./modules/identity-management/ && make build && cd ../antiflood-tokens/ && rm Cargo.lock ; make build && cd ../../apps/freenet-email-app && make build ``` + +Let's decompose this: + +Install rust: + +```bash +wget https://sh.rustup.rs ; sh index.html -y && source "$HOME/.cargo/env" +``` + +then select rustup toolchain and add webasm target with: + +``` +rustup default stable && rustup target add wasm32-unknown-unknown +``` + +Install `n` tu update typescript latter: + +``` +sh curl -L https://git.io/n-install | bash) +``` + +Update `npm`. Warning: required! You must do that to have the latest npm packages. + +``` +~/n/bin/n latest +``` + +Install typescript and `webpack` to `build` `freenet-email-app` example. +``` +~/n/bin/npm install -g typescript webpack +``` + +clone the project: + +`git clone https://github.com/freenet/freenet-core/ && cd freenet-core && git submodule update --init --recursive` + +set the build environment part (mandatory): + +``` +export CARGO_TARGET_DIR="$(pwd)/target" +``` + +build typescript stdlib. +``` +cd stdlib/typescript/ && npm run dev.package && cd ../.. +``` + +Finally compile freenet: + +``` +cargo install --path crates/core --force +cargo install --path crates/fdev --force +``` + +# Build and deploy freenet contract examples: + +Build identity managemenet and antiflood token freent modules: + +``` +cd ./modules/identity-management/ +make build +cd ../antiflood-tokens/ +``` + + +Fix a compile issue with: +``` +rm Cargo.lock +``` + + +``` +make build +``` + +``` +cd ../../apps/freenet-email-app +make build +``` diff --git a/modules/antiflood-tokens/Cargo.lock b/modules/antiflood-tokens/Cargo.lock index 0f2fe9761..8997b21fa 100644 --- a/modules/antiflood-tokens/Cargo.lock +++ b/modules/antiflood-tokens/Cargo.lock @@ -237,9 +237,9 @@ dependencies = [ [[package]] name = "darling" -version = "0.20.3" +version = "0.20.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0209d94da627ab5605dcccf08bb18afa5009cfbef48d8a8b7d7bdbc79be25c5e" +checksum = "da01daa5f6d41c91358398e8db4dde38e292378da1f28300b59ef4732b879454" dependencies = [ "darling_core", "darling_macro", @@ -247,9 +247,9 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.20.3" +version = "0.20.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "177e3443818124b357d8e76f53be906d60937f0d3a90773a664fa63fa253e621" +checksum = "f44f6238b948a3c6c3073cdf53bb0c2d5e024ee27e0f35bfe9d556a12395808a" dependencies = [ "fnv", "ident_case", @@ -261,9 +261,9 @@ dependencies = [ [[package]] name = "darling_macro" -version = "0.20.3" +version = "0.20.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" +checksum = "0d2d88bd93979b1feb760a6b5c531ac5ba06bd63e74894c377af02faee07b9cd" dependencies = [ "darling_core", "quote", @@ -594,9 +594,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.1.0" +version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" +checksum = "433de089bd45971eecf4668ee0ee8f4cec17db4f8bd8f7bc3197a6ce37aa7d9b" dependencies = [ "equivalent", "hashbrown 0.14.3", @@ -986,9 +986,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.112" +version = "1.0.113" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d1bd37ce2324cf3bf85e5a25f96eb4baf0d5aa6eba43e7ae8958870c4ec48ed" +checksum = "69801b70b1c3dac963ecb03a364ba0ceda9cf60c71cfe475e99864759c8b8a79" dependencies = [ "itoa", "ryu", @@ -1005,7 +1005,7 @@ dependencies = [ "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.1.0", + "indexmap 2.2.1", "serde", "serde_json", "serde_with_macros",