summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nsis/Makefile.am11
-rwxr-xr-xnsis/find_dlls.sh82
2 files changed, 5 insertions, 88 deletions
diff --git a/nsis/Makefile.am b/nsis/Makefile.am
index 72f8ab9..8eead42 100644
--- a/nsis/Makefile.am
+++ b/nsis/Makefile.am
@@ -1,13 +1,12 @@
-EXTRA_DIST = find_dlls.sh installer.nsi.in
+EXTRA_DIST = installer.nsi.in
-CLEANFILES = $(PACKAGE_NAME)-Setup.exe deps/*
+CLEANFILES = *Setup.exe deps/*
SEARCHPATH=$$PATH
-DEPENDENCIES = $(shell ./find_dlls.sh -q -s $(SEARCHPATH) '../src/$(PACKAGE_NAME).exe')
+DLLS = $(shell ntldd -R ../src/$(PACKAGE_NAME).exe | sed 's/.*=> //g' | grep -v "not found" | sed 's/ (.*)$$//g' | sed 's/\\/\\\\/g' | xargs cygpath -u | grep "$$MINGW_PREFIX")
.PHONY: installer
-installer: $(PACKAGE_NAME)-Setup.exe
-$(PACKAGE_NAME)-Setup.exe: installer.nsi
+installer: installer.nsi
mkdir -p deps
- for file in $(DEPENDENCIES); do install "$$file" "deps/$$(basename "$$file")"; done
+ for file in $(DLLS); do install "$$file" "deps/$$(basename "$$file")"; done
makensis installer.nsi
diff --git a/nsis/find_dlls.sh b/nsis/find_dlls.sh
deleted file mode 100755
index 6e02688..0000000
--- a/nsis/find_dlls.sh
+++ /dev/null
@@ -1,82 +0,0 @@
-#!/usr/bin/env sh
-
-###############################################################################
-# Script to determine dll dependencies of a Windows executable file. #
-# This should help automate the process of locating dlls to include as part #
-# of an installer. #
-# #
-# This script is licensed under the GPLv3+ #
-# Written by Louie Shprung <lshprung@tutanota.com> #
-###############################################################################
-
-help() {
- echo "Usage: $0 [OPTION]... BINARY..."
- echo "Determine dlls required by BINARY (an .exe or .dll file)"
- echo
- echo "Options:"
- echo " -h display this help message and exit"
- echo " -q hide warnings"
- echo " -s PATH set a path to search for dlls on. Default is \$PATH"
-}
-
-get_dll_path() {
- (
- IFS=':'
- for path in $SEARCHPATH; do
- if [ -e "$path/$1" ]; then
- echo "$path/$1"
- return 0
- fi
- done
- echo "Warning: Could not locate '$1' on system"
- return 1
- )
-}
-
-print_dlls() {
- while [ -n "$1" ]; do
- DLL_NAMES=$(objdump -x "$1" | grep "DLL Name: " | sed 's/^[^D]*DLL Name: //')
- for file in $DLL_NAMES; do
- if DLL_PATH="$(get_dll_path "$file")"; then
- echo "$DLL_PATH"
- print_dlls "$DLL_PATH"
- elif [ "$WARNINGS" -eq 1 ]; then
- echo "$DLL_PATH"
- fi
- done
- shift
- done
-}
-
-SEARCHPATH="$PATH"
-WARNINGS=1
-
-# Check args
-while getopts "hqs:" flag; do
- case "$flag" in
- h)
- help
- exit
- ;;
- q)
- WARNINGS=0
- ;;
- s)
- SEARCHPATH="${OPTARG}"
- ;;
- *)
- break
- esac
-done
-shift $((OPTIND-1))
-
-if [ -z "$1" ]; then
- help
- exit 1
-fi
-
-if [ ! -e "$1" ]; then
- >&2 echo "Error: '$1' does not exist - skipping"
-fi
-
-print_dlls "$@"