Commit 8383dce1d0e5dbc3251305ae0d596ecf62c6623c
1 parent
54968107
Exists in
master
and in
5 other branches
Melhorando construção do runtime windows
Showing
1 changed file
with
124 additions
and
0 deletions
Show diff stats
| ... | ... | @@ -0,0 +1,124 @@ |
| 1 | +#!/bin/bash | |
| 2 | +myDIR=$(dirname $(readlink -f $0)) | |
| 3 | + | |
| 4 | +prefix="/usr/i686-w64-mingw32/sys-root/mingw" | |
| 5 | +PKG_CONFIG="/usr/bin/i686-w64-mingw32-pkg-config" | |
| 6 | +GTK_VERSION="gtk+-3.0" | |
| 7 | + | |
| 8 | +GTK_PREFIX=$($PKG_CONFIG --variable=prefix ${GTK_VERSION}) | |
| 9 | + | |
| 10 | +TARGET="$(dirname ${myDIR})/.bin/runtime" | |
| 11 | + | |
| 12 | +# Change to bin path | |
| 13 | +mkdir -p ${TARGET} | |
| 14 | +rm -fr ${TARGET}/* | |
| 15 | + | |
| 16 | +AGAIN=1 | |
| 17 | +until [ $AGAIN = 0 ]; do | |
| 18 | + | |
| 19 | + SOURCES=$(mktemp) | |
| 20 | + REQUIRES=$(mktemp) | |
| 21 | + | |
| 22 | + find "$(dirname ${myDIR})/.bin/Release/" -iname "*.dll" > ${SOURCES} | |
| 23 | + find "$(dirname ${myDIR})/.bin/Release/" -iname "*.exe" >> ${SOURCES} | |
| 24 | + find "${TARGET}" -iname *.dll >> ${SOURCES} | |
| 25 | + | |
| 26 | + while read FILENAME | |
| 27 | + do | |
| 28 | + objdump -p ${FILENAME} | grep "DLL Name:" | cut -d: -f2 | tr "[:upper:]" "[:lower:]" >> ${REQUIRES} | |
| 29 | + done < ${SOURCES} | |
| 30 | + | |
| 31 | + libs_to_exclude=" | |
| 32 | + advapi32 | |
| 33 | + cfgmgr32 | |
| 34 | + comctl32 | |
| 35 | + comdlg32 | |
| 36 | + crypt32 | |
| 37 | + d3d8 | |
| 38 | + d3d9 | |
| 39 | + ddraw | |
| 40 | + dnsapi | |
| 41 | + dsound | |
| 42 | + dwmapi | |
| 43 | + gdi32 | |
| 44 | + gdiplus | |
| 45 | + glu32 | |
| 46 | + glut32 | |
| 47 | + imm32 | |
| 48 | + iphlpapi | |
| 49 | + kernel32 | |
| 50 | + ksuser | |
| 51 | + mpr | |
| 52 | + mscms | |
| 53 | + mscoree | |
| 54 | + msimg32 | |
| 55 | + msvcr71 | |
| 56 | + msvcr80 | |
| 57 | + msvcr90 | |
| 58 | + msvcrt | |
| 59 | + mswsock | |
| 60 | + netapi32 | |
| 61 | + odbc32 | |
| 62 | + ole32 | |
| 63 | + oleacc | |
| 64 | + oleaut32 | |
| 65 | + opengl32 | |
| 66 | + psapi | |
| 67 | + rpcrt4 | |
| 68 | + secur32 | |
| 69 | + setupapi | |
| 70 | + shell32 | |
| 71 | + shlwapi | |
| 72 | + user32 | |
| 73 | + usp10 | |
| 74 | + version | |
| 75 | + wininet | |
| 76 | + winmm | |
| 77 | + wldap32 | |
| 78 | + ws2_32 | |
| 79 | + wsock32 | |
| 80 | + winspool.drv | |
| 81 | + " | |
| 82 | + | |
| 83 | + # Excluo DLLs do sistema | |
| 84 | + for i in $libs_to_exclude; do | |
| 85 | + sed -i -e "/${i}/d" ${REQUIRES} | |
| 86 | + done | |
| 87 | + | |
| 88 | + # Procuro pelas DLLs que faltam | |
| 89 | + AGAIN=0 | |
| 90 | + while read FILENAME | |
| 91 | + do | |
| 92 | + if [ ! -e "${TARGET}/${FILENAME}" ]; then | |
| 93 | + | |
| 94 | + COUNT=$(find "$(dirname ${myDIR})/.bin/Release/" -iname ${FILENAME} | wc --lines) | |
| 95 | + if [ "${COUNT}" == "0" ]; then | |
| 96 | + | |
| 97 | + if [ -e ${prefix}/bin/${FILENAME} ]; then | |
| 98 | + | |
| 99 | + echo "Copiando $(basename ${FILENAME})..." | |
| 100 | + | |
| 101 | + AGAIN=1 | |
| 102 | + cp -v "${prefix}/bin/${FILENAME}" "${TARGET}/${FILENAME}" | |
| 103 | + if [ "$?" != "0" ]; then | |
| 104 | + exit -1 | |
| 105 | + fi | |
| 106 | + else | |
| 107 | + | |
| 108 | + echo "Can't find ${FILENAME}" | |
| 109 | + | |
| 110 | + fi | |
| 111 | + | |
| 112 | + fi | |
| 113 | + | |
| 114 | + | |
| 115 | + fi | |
| 116 | + | |
| 117 | + done < ${REQUIRES} | |
| 118 | + | |
| 119 | + rm -f ${SOURCES} | |
| 120 | + rm -f ${REQUIRES} | |
| 121 | + | |
| 122 | +done | |
| 123 | + | |
| 124 | + | ... | ... |