-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
write a new gen file for updating emulator libs and update docs
- Loading branch information
1 parent
78b7625
commit 258ce2b
Showing
7 changed files
with
129 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,16 @@ | ||
### Guide build for macOS | ||
### Guide to build for macOS | ||
|
||
#### Install lib | ||
|
||
1) `git clone --recurse-submodules -b master https://github.com/ton-blockchain/ton.git` | ||
2) `mkdir build && cd build` | ||
3) `cmake ..` | ||
4) `cmake --build . -- target emulator` | ||
1) `brew tap ton-blockchain/ton` | ||
2) `brew install ton` | ||
|
||
When you see the successful status of the build, you can find the `libemulator.dylib` file in the `build/emulator` folder. | ||
#### Upgrade lib | ||
|
||
1) brew update | ||
2) brew reinstall ton | ||
|
||
When you see the successful status of the build, you can find the `libemulator.dylib` file in the `/opt/homebrew/lib` | ||
folder. | ||
|
||
💡 Full information can be found at github.com/ton-blockchain/packages |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
//go:generate go run gen.go | ||
|
||
package main | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
"os" | ||
"os/exec" | ||
) | ||
|
||
func main() { | ||
if err := darwinDownload(); err != nil { | ||
log.Fatalf("failed to download file for macos: %v", err) | ||
} | ||
if err := linuxDownload(); err != nil { | ||
log.Fatalf("failed to download file for linux: %v", err) | ||
} | ||
} | ||
|
||
func darwinDownload() error { | ||
const path = "/opt/homebrew/lib" | ||
const name = "libemulator.dylib" | ||
|
||
log.Println("starting download lib for macos") | ||
|
||
initTonCmd := exec.Command("brew", "tap", "ton-blockchain/ton") | ||
if output, err := initTonCmd.CombinedOutput(); err != nil { | ||
return fmt.Errorf("[darwinDownload] failed to init ton: %v, output: %s", err, output) | ||
} | ||
|
||
_, err := os.Stat(fmt.Sprintf("%v/%v", path, name)) | ||
if err == nil { | ||
log.Println("file already exist, reinstalling lib...") | ||
reinstallCmd := exec.Command("brew", "reinstall", "ton") | ||
if output, err := reinstallCmd.CombinedOutput(); err != nil { | ||
return fmt.Errorf("[darwinDownload] failed to reinstall lib: %v, output: %s", err, output) | ||
} | ||
} else if os.IsNotExist(err) { | ||
log.Println("file doesn't exist, installing lib...") | ||
installCmd := exec.Command("brew", "install", "ton") | ||
if output, err := installCmd.CombinedOutput(); err != nil { | ||
return fmt.Errorf("[darwinDownload] failed to install lib: %v, output: %s", err, output) | ||
} | ||
} else { | ||
return fmt.Errorf("failed to check file: %v", err) | ||
} | ||
|
||
copyCmd := exec.Command("cp", fmt.Sprintf("%v/%v", path, name), "darwin/") | ||
if output, err := copyCmd.CombinedOutput(); err != nil { | ||
return fmt.Errorf("[darwinDownload] failed to copy file: %v, output: %s", err, output) | ||
} | ||
|
||
log.Println("[darwinDownload] successfully update lib") | ||
|
||
return nil | ||
} | ||
|
||
func linuxDownload() error { | ||
const path = "/usr/lib" | ||
const name = "libemulator.so" | ||
|
||
log.Println("starting download lib for linux") | ||
|
||
commands := [][]string{ | ||
{"sudo", "apt-key", "adv", "--keyserver", "keyserver.ubuntu.com", "--recv-keys", "F6A649124520E5F3"}, | ||
{"sudo", "add-apt-repository", "ppa:ton-foundation/ppa"}, | ||
{"sudo", "apt", "update"}, | ||
{"sudo", "apt", "install", "ton"}, | ||
} | ||
for _, command := range commands { | ||
cmd := exec.Command(command[0], command[1:]...) | ||
if output, err := cmd.CombinedOutput(); err != nil { | ||
return fmt.Errorf("[linuxDownload] failed to install lib: %v, output: %s", err, output) | ||
} | ||
} | ||
|
||
copyCmd := exec.Command("cp", fmt.Sprintf("%v/%v", path, name), "linux/") | ||
if output, err := copyCmd.CombinedOutput(); err != nil { | ||
return fmt.Errorf("[linuxDownload] failed to copy file: %v, output: %s", err, output) | ||
} | ||
|
||
log.Println("[linuxDownload] successfully update lib") | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package lib | ||
package main | ||
|
||
import ( | ||
_ "github.com/tonkeeper/tongo/lib/darwin" | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,20 @@ | ||
## Usage | ||
### Guide to build for Linux | ||
|
||
#### Install lib | ||
|
||
``` | ||
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F6A649124520E5F3 | ||
sudo add-apt-repository ppa:ton-foundation/ppa | ||
sudo apt update | ||
sudo apt install ton | ||
``` | ||
|
||
Copy `libemulator.so` to /usr/lib or use environment variable `LD_LIBRARY_PATH` | ||
|
||
### Build guide for Linux | ||
When you see the successful status of the build, you can find the `libemulator.so` file in the `/opt/homebrew/lib` | ||
folder. | ||
|
||
#### Usage | ||
|
||
Copy `libemulator.so` to /usr/lib or use environment variable `LD_LIBRARY_PATH` | ||
|
||
cd lib/linux | ||
docker build . -t ton-emulator | ||
docker create --name ton-emulator ton-emulator | ||
docker cp ton-emulator:/output/libemulator.so . | ||
💡 Full information can be found at github.com/ton-blockchain/packages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
### Guide to build for Windows | ||
|
||
Please, be aware that multiple false positive alarms from various antivirus vendors may occur. This is an expected | ||
behaviour and there is no reason to worry. | ||
|
||
#### Install lib | ||
|
||
Open an elevated terminal (Run as Administrator) and execute the below command: | ||
|
||
`choco install ton` | ||
|
||
💡 Full information can be found at github.com/ton-blockchain/packages |