diff --git a/meson.build b/meson.build
index 1c1a4b81b61e81087debb4acf102526ac6e76c6e..70e40f579baf6f0bedd218cbe01c12329e5c36e3 100644
--- a/meson.build
+++ b/meson.build
@@ -93,8 +93,8 @@ generated_deps = [ declare_dependency( link_with: static_library( 'generated'
                                                                                  , command: [ find_program('xxd'), '-i', '@INPUT@', '@OUTPUT@' ] ) ]
                                                                 , [ custom_target( 'manpath'
                                                                                  , output: 'manpath.c'
-                                                                                 , input: 'scripts/getmanpath.sh'
-                                                                                 , command: [ find_program('scripts/getmanpath.sh'), '@OUTPUT@' ] ) ] )
+                                                                                 , input: 'meson.build'
+                                                                                 , command: [ find_program('sh'), '-c', 'echo \'const char *man_executable_path = "\'"$(which man)"\'";\' > @OUTPUT@' ] ) ] )
                                      ) ]
 
 lib = static_library( 'lektor'
diff --git a/scripts/getmanpath.sh b/scripts/getmanpath.sh
deleted file mode 100755
index 84a088cea05c9aa6c413fb4700f32ecc11574b2e..0000000000000000000000000000000000000000
--- a/scripts/getmanpath.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh
-
-# $1: output file
-[ $# -ne 1 ] && exit 1
-echo "const char *man_executable_path = \"$(which man)\";" > "$1"