new shell script for installing DLLs on MSYS2.

imported https://gitlab.com/void995/netradiant/commits/working_multithreading_on_windows
This commit is contained in:
Garux 2018-02-08 00:09:46 +03:00
parent 5aec9aec87
commit 42e6cf618c
2 changed files with 98 additions and 2 deletions

View File

@ -174,7 +174,7 @@ ifeq ($(findstring $(CFLAGS),-O),)
CFLAGS_COMMON += -O3
# only add -O3 if no -O flag is in $(CFLAGS)
endif
CFLAGS_COMMON += -march=native -mcpu=native
CFLAGS_COMMON += -march=native -mtune=native
CPPFLAGS_COMMON +=
LDFLAGS_COMMON += -s
else
@ -250,6 +250,24 @@ endif
endif
endif
# MSYS2
UNAME_S := $(shell uname -s)
UNAME_O := $(shell uname -o)
ifneq "$(filter MINGW32_NT%,$(UNAME_S))" ""
OS = Win32
ifeq ($(UNAME_O),Msys)
DLLINSTALL = install-dlls-msys2-mingw.sh
endif
endif
ifneq "$(filter MINGW64_NT%,$(UNAME_S))" ""
OS = Win32
ifeq ($(UNAME_O),Msys)
DLLINSTALL = install-dlls-msys2-mingw.sh
endif
endif
# VERSION!
RADIANT_VERSION_NUMBER = 1.5.0
RADIANT_VERSION = $(RADIANT_VERSION_NUMBER)n
@ -456,8 +474,8 @@ binaries-q3map2: \
.PHONY: clean
clean:
$(RM_R) $(INSTALLDIR_BASE)/
$(FIND) . \( -name \*.o -o -name \*.d -o -name \*.$(DLL) -o -name \*.$(A) -o -name \*.$(EXE) \) -exec $(RM) {} \;
$(RM_R) $(INSTALLDIR_BASE)/
$(RM) icons/*.rc
%.$(EXE):

View File

@ -0,0 +1,78 @@
#!/bin/sh
# set -ex
INSTALLDIR=`pwd`/install
if [[ `file $INSTALLDIR/radiant.exe` == *"x86-64"* ]]; then
MINGWDIR=/mingw64
else
MINGWDIR=/mingw32
fi
function dependencies_single_target_no_depth {
local TARGET=$1
local DEPENDENCIESFILTER="| grep 'DLL Name' | sed -r 's/\s+DLL\s+Name\:\s+//' | xargs -i{} which {} | grep $MINGWDIR/bin"
local COMMAND="objdump -x $TARGET $DEPENDENCIESFILTER | xargs -i{} echo {}"
local DEPENDENCIES=`eval "$COMMAND"`
if [ "$DEPENDENCIES" != "" ]; then
echo "$DEPENDENCIES"
fi
}
function dependencies {
local TARGETS=$@
local TEMPORARYFILEA="install-dlls-msys2-mingw.alldependencies.tmp"
local TEMPORARYFILEB="install-dlls-msys2-mingw.dependencies.tmp"
local ALLDEPENDENCIES=""
for TARGET in $TARGETS; do
local ALLDEPENDENCIES=`dependencies_single_target_no_depth "$TARGET" && echo "$ALLDEPENDENCIES"`
done
local ALLDEPENDENCIES=`echo "$ALLDEPENDENCIES" | sort -u`
local NEWDEPENDENCIES="$ALLDEPENDENCIES"
while [ "$NEWDEPENDENCIES" != "" ]; do
local DEPENDENCIES=""
for DEPENDENCY in $NEWDEPENDENCIES; do
DEPENDENCIES=`dependencies_single_target_no_depth "$DEPENDENCY" && echo "$DEPENDENCIES"`
done
echo "$ALLDEPENDENCIES" > "$TEMPORARYFILEA"
echo "$DEPENDENCIES" | sort -u > "$TEMPORARYFILEB"
local NEWDEPENDENCIES=`comm -13 "$TEMPORARYFILEA" "$TEMPORARYFILEB"`
if [ "$NEWDEPENDENCIES" != "" ]; then
local ALLDEPENDENCIES=`printf '%s\n' "$ALLDEPENDENCIES" "$NEWDEPENDENCIES" | sort`
fi
rm "$TEMPORARYFILEA" "$TEMPORARYFILEB"
done
if [ "$ALLDEPENDENCIES" != "" ]; then
echo "$ALLDEPENDENCIES"
fi
}
for DEPENDENCY in `dependencies ./install/*.exe`; do
cp -v "$DEPENDENCY" "$INSTALLDIR"
done
cd $MINGWDIR
for EXTRAPATH in \
'./lib/gtk-2.0/2.10.0/engines/*.dll' \
'./lib/gtk-2.0/modules/*.dll' \
'./share/themes' \
; do
cp --parent -v `find $EXTRAPATH -type f` "$INSTALLDIR"
done