Skip to content

Commit

Permalink
[electrs] Support out-of-source-tree build
Browse files Browse the repository at this point in the history
  • Loading branch information
dagurval committed Apr 4, 2019
1 parent 6eae554 commit 12c9b71
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
7 changes: 3 additions & 4 deletions Makefile.am
Expand Up @@ -79,7 +79,7 @@ $(OSX_APP)/Contents/PkgInfo:

$(OSX_APP)/Contents/Resources/empty.lproj:
$(MKDIR_P) $(@D)
@touch $@
@touch $@

$(OSX_APP)/Contents/Info.plist: $(OSX_PLIST)
$(MKDIR_P) $(@D)
Expand Down Expand Up @@ -218,9 +218,8 @@ endif
check-formatting:
$(MAKE) -C src $@

.PHONY: electrs
electrs:
$(top_srcdir)/contrib/electrs/build_electrs.py
electrs: ${PWD}/src/electrs
$(top_srcdir)/contrib/electrs/build_electrs.py --dst=${PWD}/src

dist_noinst_SCRIPTS = autogen.sh

Expand Down
10 changes: 7 additions & 3 deletions contrib/electrs/build_electrs.py
Expand Up @@ -17,6 +17,8 @@
action = "store_true")
parser.add_argument('--verbose', help='Sets log level to DEBUG',
action = "store_true")
parser.add_argument('--dst', help='Where to copy produced binary',
default=os.path.join(ROOT_DIR, "src"))
args = parser.parse_args()

level = logging.DEBUG if args.verbose else logging.INFO
Expand Down Expand Up @@ -47,6 +49,9 @@ def check_dependencies():
logging.error("You need to install rust (1.28+) https://rustup.rs/")
bail("rust not found")

if not os.path.isdir(args.dst):
bail("--dst provided '%s' is not a directory", args.dst)

def clone_repo():
import git
logging.info("Cloning %s to %s", GIT_REPO, ELECTRS_DIR)
Expand Down Expand Up @@ -109,8 +114,7 @@ def cargo_run(args):
cargo_run(["test", "--release"])

src = os.path.join(ELECTRS_DIR, "target", "release", "electrs")
dst = os.path.join(ROOT_DIR, "src")
logging.info("Copying %s to %s", src, dst)
shutil.copy(src, dst)
logging.info("Copying %s to %s", src, args.dst)
shutil.copy(src, args.dst)

logging.info("Done")

0 comments on commit 12c9b71

Please sign in to comment.