From 6f2ddd0c0a95baa491c2942749a63bc52866e76c Mon Sep 17 00:00:00 2001 From: Matt Raffel Date: Thu, 4 Apr 2019 09:17:41 -0600 Subject: [PATCH 1/6] adds initial file Signed-off-by: Matt Raffel --- doc/building.md | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 doc/building.md diff --git a/doc/building.md b/doc/building.md new file mode 100644 index 000000000..bfcaab8ec --- /dev/null +++ b/doc/building.md @@ -0,0 +1,49 @@ +Building Libsovtoken + + +## Windows Builds +### Prerequisites +Visual Studio, git, etc + + +### Step 1 +Start with following the directions for building indy sdk: + +https://github.com/hyperledger/indy-sdk/blob/master/docs/build-guides/windows-build.md + +#### Step 1 Notes +some differences in what I did: +downloaded openssl from here: https://slproweb.com/products/Win32OpenSSL.html. When prompted for where the libraries should go, I chose bin directory + + +### Step 2 +For this example +- all libraries and prebuilt prebuilt indy-sdk dependencies was put in `d:\engineering\libs` +- during open ssl install, selected the option install opensll in bin sub-directory + +Set the following environment variables: +``` +SET OPENSSL_DIR=C:\PROGRA~1\OPENSS~1\ +SET X86_64_PC_WINDOWS_MSVC_OPENSSL_LIB_DIR=%OPENSSL_DIR%lib +SET OPENSSL_INCLUDE_DIR=%OPENSSL_DIR%include +SET X86_64_PC_WINDOWS_MSVC_OPENSSL_INCLUDE_DIR=%OPENSSL_DIR%include +SET SODIUM_LIB_DIR=d:\engineering\libs +SET SODIUM_STATIC=d:\engineering\libs\lib +SET LIBINDY_DIR=d:\engineering\libs +SET INDY_PREBUILT_DEPS_DIR=d:\engineering\libs + +SET INDY_PREBUILT_DEPS_DIR=d:\engineering\libs +SET INDY_CRYPTO_PREBUILT_DEPS_DIR=d:\engineering\libs +SET MILAGRO_DIR=d:\engineering\libs +SET LIBZMQ_PREFIX=d:\engineering\libs +``` + +#### Step 2 notes +Use short file names and short directory names. There seemed to be some problems with long names. + + +### Step 3 (optional) +build indy-sdk (if you can get the windows build of indy-sdk then you can skip this) using the standard cargo build command and copied dll and lib to d:\engineering\libs + +### Step 4 +build libsovtoken using the standard `cargo build` command From bbebc2671d2ae67b7a6a8506f7f055d8c1ed558a Mon Sep 17 00:00:00 2001 From: Matt Raffel Date: Thu, 4 Apr 2019 09:36:35 -0600 Subject: [PATCH 2/6] making pr Signed-off-by: Matt Raffel --- doc/building.md | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/doc/building.md b/doc/building.md index bfcaab8ec..b3cde55b6 100644 --- a/doc/building.md +++ b/doc/building.md @@ -3,20 +3,22 @@ Building Libsovtoken ## Windows Builds ### Prerequisites -Visual Studio, git, etc +- Visual Studio, rust, git, etc...are installed +- rust builds demo project -### Step 1 -Start with following the directions for building indy sdk: +### Step 1 Preparation +Start with reading the directions for [building indy sdk on windows](https://github.com/hyperledger/indy-sdk/blob/master/docs/build-guides/windows-build.md). -https://github.com/hyperledger/indy-sdk/blob/master/docs/build-guides/windows-build.md +The most important step is downloading the prebuilt dependencies (unless you want to build them yourself). + +Building LibIndy is not required if you are able to download the prebuilt LibIndy libraries. Suggestion is to start [here](https://github.com/hyperledger/indy-sdk/blob/master/docs/build-guides/windows-build.md#build) and work backward if there are any problems. #### Step 1 Notes -some differences in what I did: -downloaded openssl from here: https://slproweb.com/products/Win32OpenSSL.html. When prompted for where the libraries should go, I chose bin directory +Downloaded openssl from [here](https://slproweb.com/products/Win32OpenSSL.html). See notes below about installation configuration. -### Step 2 +### Step 2 Environment Configuration For this example - all libraries and prebuilt prebuilt indy-sdk dependencies was put in `d:\engineering\libs` - during open ssl install, selected the option install opensll in bin sub-directory @@ -39,11 +41,13 @@ SET LIBZMQ_PREFIX=d:\engineering\libs ``` #### Step 2 notes -Use short file names and short directory names. There seemed to be some problems with long names. - +- Use short file names and short directory names for the SSL configuration. There seemed to be some problems with long names. +- Alternatively: if you chose to build libindy, set `LIBINDY_DIR` to the build output directory. +This is typically `{libindy source directory}\target\[debug | release]` ### Step 3 (optional) -build indy-sdk (if you can get the windows build of indy-sdk then you can skip this) using the standard cargo build command and copied dll and lib to d:\engineering\libs +build indy-sdk (if you can get the windows build of indy-sdk then you can skip this) using the standard `cargo build` command and, +if necessary, copy dll and lib to `LIBINDY_DIR` -### Step 4 +### Step 4 Building Libsovtoken build libsovtoken using the standard `cargo build` command From 7b3e3014c789728d6587aebcdaef91d785adff54 Mon Sep 17 00:00:00 2001 From: Matt Raffel Date: Thu, 4 Apr 2019 09:44:33 -0600 Subject: [PATCH 3/6] removing duplicate word Signed-off-by: Matt Raffel --- doc/building.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/building.md b/doc/building.md index b3cde55b6..49a28e4bd 100644 --- a/doc/building.md +++ b/doc/building.md @@ -20,7 +20,7 @@ Downloaded openssl from [here](https://slproweb.com/products/Win32OpenSSL.html). ### Step 2 Environment Configuration For this example -- all libraries and prebuilt prebuilt indy-sdk dependencies was put in `d:\engineering\libs` +- all libraries and prebuilt indy-sdk dependencies was put in `d:\engineering\libs` - during open ssl install, selected the option install opensll in bin sub-directory Set the following environment variables: From 3f74f8f41044f5458d050e3bca68c2086a802d6b Mon Sep 17 00:00:00 2001 From: Matt Raffel Date: Thu, 4 Apr 2019 09:48:34 -0600 Subject: [PATCH 4/6] format change Signed-off-by: Matt Raffel --- doc/building.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/building.md b/doc/building.md index 49a28e4bd..81333d3d6 100644 --- a/doc/building.md +++ b/doc/building.md @@ -1,4 +1,4 @@ -Building Libsovtoken +# Building Libsovtoken ## Windows Builds From 26b118be7d51e25860e196d8926e9e83fa6e5253 Mon Sep 17 00:00:00 2001 From: Matt Raffel Date: Fri, 5 Apr 2019 10:34:14 -0600 Subject: [PATCH 5/6] fixed typos Signed-off-by: Matt Raffel --- doc/building.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/building.md b/doc/building.md index 81333d3d6..76dffc103 100644 --- a/doc/building.md +++ b/doc/building.md @@ -21,7 +21,7 @@ Downloaded openssl from [here](https://slproweb.com/products/Win32OpenSSL.html). ### Step 2 Environment Configuration For this example - all libraries and prebuilt indy-sdk dependencies was put in `d:\engineering\libs` -- during open ssl install, selected the option install opensll in bin sub-directory +- during openssl install, selected the option install openssl in bin sub-directory Set the following environment variables: ``` From f309d9350eafd9616fec48956fdc69418245b83b Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Wed, 10 Apr 2019 15:32:17 +0300 Subject: [PATCH 6/6] ST-315 Simplified documentation for building on windows Signed-off-by: artem.ivanov --- README.md | 3 ++ doc/build-guides/windows-build.md | 21 ++++++++++++ doc/building.md | 53 ------------------------------- libsovtoken/build.rs | 21 ++++++------ 4 files changed, 36 insertions(+), 62 deletions(-) create mode 100644 doc/build-guides/windows-build.md delete mode 100644 doc/building.md diff --git a/README.md b/README.md index 41677adab..e890fe3b8 100644 --- a/README.md +++ b/README.md @@ -105,6 +105,9 @@ Adds Sovrin's token functionality to HyperLedger's Indy-SDK. 1. cargo test +### How to build Libsovtoken from source +* [Windows](doc/build-guides/windows-build.md) + ## How To Contribute diff --git a/doc/build-guides/windows-build.md b/doc/build-guides/windows-build.md new file mode 100644 index 000000000..91ff760a2 --- /dev/null +++ b/doc/build-guides/windows-build.md @@ -0,0 +1,21 @@ +# Building Libsovtoken for Windows + +### Step 1 Build Liibndy +Go through [indy sdk on windows build documentation](https://github.com/hyperledger/indy-sdk/blob/master/docs/build-guides/windows-build.md) to get libindy artifacts. +The most important steps are: +* [Downloading of the Indy prebuilt dependencies](https://github.com/hyperledger/indy-sdk/blob/master/docs/build-guides/windows-build.md#getbuild-dependencies) +* [Libindy building]( https://github.com/hyperledger/indy-sdk/blob/master/docs/build-guides/windows-build.md#build) + +### Step 2 Environment Configuration +For this example +- all libraries and prebuilt indy-sdk dependencies was put in `C:\BIN\x64` + +Set the following environment variables: +``` +SET OPENSSL_DIR=C:\BIN\x64 +SET SODIUM_LIB_DIR=C:\BIN\x64\lib +SET LIBINDY_DIR={libindy source directory}\target\[debug | release] +``` + +### Step 4 Building Libsovtoken +Build libsovtoken using the standard `cargo build` command diff --git a/doc/building.md b/doc/building.md deleted file mode 100644 index 76dffc103..000000000 --- a/doc/building.md +++ /dev/null @@ -1,53 +0,0 @@ -# Building Libsovtoken - - -## Windows Builds -### Prerequisites -- Visual Studio, rust, git, etc...are installed -- rust builds demo project - - -### Step 1 Preparation -Start with reading the directions for [building indy sdk on windows](https://github.com/hyperledger/indy-sdk/blob/master/docs/build-guides/windows-build.md). - -The most important step is downloading the prebuilt dependencies (unless you want to build them yourself). - -Building LibIndy is not required if you are able to download the prebuilt LibIndy libraries. Suggestion is to start [here](https://github.com/hyperledger/indy-sdk/blob/master/docs/build-guides/windows-build.md#build) and work backward if there are any problems. - -#### Step 1 Notes -Downloaded openssl from [here](https://slproweb.com/products/Win32OpenSSL.html). See notes below about installation configuration. - - -### Step 2 Environment Configuration -For this example -- all libraries and prebuilt indy-sdk dependencies was put in `d:\engineering\libs` -- during openssl install, selected the option install openssl in bin sub-directory - -Set the following environment variables: -``` -SET OPENSSL_DIR=C:\PROGRA~1\OPENSS~1\ -SET X86_64_PC_WINDOWS_MSVC_OPENSSL_LIB_DIR=%OPENSSL_DIR%lib -SET OPENSSL_INCLUDE_DIR=%OPENSSL_DIR%include -SET X86_64_PC_WINDOWS_MSVC_OPENSSL_INCLUDE_DIR=%OPENSSL_DIR%include -SET SODIUM_LIB_DIR=d:\engineering\libs -SET SODIUM_STATIC=d:\engineering\libs\lib -SET LIBINDY_DIR=d:\engineering\libs -SET INDY_PREBUILT_DEPS_DIR=d:\engineering\libs - -SET INDY_PREBUILT_DEPS_DIR=d:\engineering\libs -SET INDY_CRYPTO_PREBUILT_DEPS_DIR=d:\engineering\libs -SET MILAGRO_DIR=d:\engineering\libs -SET LIBZMQ_PREFIX=d:\engineering\libs -``` - -#### Step 2 notes -- Use short file names and short directory names for the SSL configuration. There seemed to be some problems with long names. -- Alternatively: if you chose to build libindy, set `LIBINDY_DIR` to the build output directory. -This is typically `{libindy source directory}\target\[debug | release]` - -### Step 3 (optional) -build indy-sdk (if you can get the windows build of indy-sdk then you can skip this) using the standard `cargo build` command and, -if necessary, copy dll and lib to `LIBINDY_DIR` - -### Step 4 Building Libsovtoken -build libsovtoken using the standard `cargo build` command diff --git a/libsovtoken/build.rs b/libsovtoken/build.rs index feffe40b6..7225c1b3f 100644 --- a/libsovtoken/build.rs +++ b/libsovtoken/build.rs @@ -11,6 +11,18 @@ fn main() { Err(..) => panic!("Missing required environment variable LIBINDY_DIR") }; + let target = env::var("TARGET").unwrap(); + println!("target={}", target); + + if target.find("-windows-").is_some() { + println!("cargo:rustc-link-lib=indy.dll"); + println!("indy_dir={}", libindy_lib_path); + let libindy_lib_path = Path::new(libindy_lib_path.as_str()); + + println!("cargo:rustc-flags=-L {}", libindy_lib_path.as_os_str().to_str().unwrap()); + return; + } + println!("cargo:rustc-link-search=native={}",libindy_lib_path); if let Ok(_mode) = env::var("LIBINDY_STATIC") { @@ -19,8 +31,6 @@ fn main() { println!("cargo:rustc-link-lib=dylib=indy"); } - let target = env::var("TARGET").unwrap(); - println!("target={}", target); if target.contains("linux-android") { let openssl = match env::var("OPENSSL_LIB_DIR") { @@ -41,12 +51,5 @@ fn main() { println!("cargo:rustc-link-lib=dylib=ssl"); println!("cargo:rustc-link-search=native={}", sodium); println!("cargo:rustc-link-lib=static=sodium"); - }else if target.find("-windows-").is_some() { - println!("cargo:rustc-link-lib=dylib=ssleay32"); - println!("cargo:rustc-link-lib=dylib=zmq"); - println!("cargo:rustc-link-lib=dylib=sodium"); - let prebuilt_dir = env::var("INDY_PREBUILT_DEPS_DIR").unwrap(); - println!("cargo:rustc-flags=-L {}\\lib", prebuilt_dir); - return; } }