diff --git a/contrib/devtools/CMakeLists.txt b/contrib/devtools/CMakeLists.txt
--- a/contrib/devtools/CMakeLists.txt
+++ b/contrib/devtools/CMakeLists.txt
@@ -1,5 +1,10 @@
# Copyright (c) 2019 The Bitcoin developers
+configure_file(
+ "split-debug.sh.cmake.in"
+ "split-debug.sh"
+)
+
add_custom_target(check-devtools)
set(DEVTOOLS_TESTS_PYTHON
diff --git a/contrib/devtools/split-debug.sh.cmake.in b/contrib/devtools/split-debug.sh.cmake.in
new file mode 100644
--- /dev/null
+++ b/contrib/devtools/split-debug.sh.cmake.in
@@ -0,0 +1,12 @@
+#!/usr/bin/env bash
+
+export LC_ALL=C
+
+if [ $# -ne 3 ];
+ then echo "usage: $0 "
+fi
+
+${CMAKE_OBJCOPY} --enable-deterministic-archives -p --only-keep-debug $1 $3
+${CMAKE_OBJCOPY} --enable-deterministic-archives -p --strip-debug $1 $2
+${CMAKE_STRIP} --enable-deterministic-archives -p -s $2
+${CMAKE_OBJCOPY} --enable-deterministic-archives -p --add-gnu-debuglink=$3 $2
diff --git a/contrib/devtools/split-debug.sh.in b/contrib/devtools/split-debug.sh.in
--- a/contrib/devtools/split-debug.sh.in
+++ b/contrib/devtools/split-debug.sh.in
@@ -1,4 +1,6 @@
-#!/bin/sh
+#!/usr/bin/env bash
+
+export LC_ALL=C
if [ $# -ne 3 ];
then echo "usage: $0 "