6
6
7
7
#! /bin/sh
8
8
9
- ARCH=${1:- x86_64}
9
+
10
+ arch=${1:- x86_64}
10
11
DEBUG=false
11
- if [ " $2 " == " DEBUG " ]; then
12
+ if [ " $2 " == " debug " ]; then
12
13
DEBUG=true
13
14
fi
14
- NJOBS=${3:- $(($(grep -c ^processor / proc/ cpuinfo) * 3 / 2))}
15
+
16
+ njobs=${3:- $(($(grep -c ^processor / proc/ cpuinfo) * 3 / 2))}
15
17
16
18
17
- if [ " $ARCH " == " i686" ]; then
19
+ if [ " $arch " == " i686" ]; then
18
20
bits=32
19
- elif [ " $ARCH " == " x86_64" ]; then
21
+ elif [ " $arch " == " x86_64" ]; then
20
22
bits=64
21
23
else
22
- echo " Error: unrecognized ARCHitecture $ARCH "
24
+ echo " Error: unrecognized architecture $arch "
23
25
exit 1
24
26
fi
25
27
35
37
fi
36
38
37
39
# Note: This script is written to be used with the Fedora mingw environment
38
- MINGWROOT=/usr/$ARCH -w64-mingw32/sys-root/mingw
40
+ MINGWROOT=/usr/$arch -w64-mingw32/sys-root/mingw
39
41
40
42
if $DEBUG ; then
41
- OPTFLAGS =" -O0 -g1 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4 -fno-omit-frame-pointer"
42
- buildtype=" DEBUG "
43
+ optflags =" -O0 -g1 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4 -fno-omit-frame-pointer"
44
+ buildtype=" Debug "
43
45
else
44
- OPTFLAGS =" -O2 -g1 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4 -fno-omit-frame-pointer"
45
- buildtype=" RelWithDEBUGInfo "
46
+ optflags =" -O2 -g1 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4 -fno-omit-frame-pointer"
47
+ buildtype=" RelWithDebugInfo "
46
48
fi
47
49
pyver=$( mingw${bits} -python3 -c " import sys; print('.'.join(list(map(str, sys.version_info))[0:2]))" )
48
50
49
51
# Halt on errors
50
52
set -e
51
53
52
- export MINGW32_CFLAGS=" $OPTFLAGS "
53
- export MINGW32_CXXFLAGS=" $OPTFLAGS "
54
- export MINGW64_CFLAGS=" $OPTFLAGS "
55
- export MINGW64_CXXFLAGS=" $OPTFLAGS "
54
+ export MINGW32_CFLAGS=" $optflags "
55
+ export MINGW32_CXXFLAGS=" $optflags "
56
+ export MINGW64_CFLAGS=" $optflags "
57
+ export MINGW64_CXXFLAGS=" $optflags "
56
58
57
59
SRCDIR=" $( readlink -f " $( dirname " $( readlink -f " $0 " ) " ) /../.." ) "
60
+
58
61
if $DEBUG ; then
59
- BUILDDIR=" $SRCDIR /build_mingw${bits} _DEBUG "
62
+ BUILDDIR=" $SRCDIR /build_mingw${bits} _debug "
60
63
else
61
64
BUILDDIR=" $SRCDIR /build_mingw${bits} "
62
65
fi
63
66
installroot=" $BUILDDIR /dist"
64
- installprefix=" $installroot /usr/$ARCH -w64-mingw32/sys-root/mingw"
67
+ installprefix=" $installroot /usr/$arch -w64-mingw32/sys-root/mingw"
65
68
66
69
# Cleanup
67
70
rm -rf " $installroot "
@@ -81,7 +84,6 @@ mkdir -p $BUILDDIR
81
84
-DQWT_INCLUDE_DIR=$MINGWROOT /include/qt5/qwt \
82
85
-DQSCI_SIP_DIR=$MINGWROOT /share/sip/PyQt5/Qsci/ \
83
86
-DBUILD_TESTING=OFF \
84
- -DZSTD_INCLUDE_DIR=/usr/x86_64-w64-mingw32/sys-root/mingw/include/zstd/ \
85
87
-DENABLE_TESTS=OFF \
86
88
-DQGIS_BIN_SUBDIR=bin \
87
89
-DQGIS_CGIBIN_SUBDIR=bin \
@@ -104,37 +106,37 @@ mkdir -p $BUILDDIR
104
106
# cd $BUILDDIR/native_crssync
105
107
# echo "Building native crssync..."
106
108
# moc-qt5 $SRCDIR/src/core/qgsapplication.h > moc_qgsapplication.cpp
107
- # g++ $OPTFLAGS -fPIC -o crssync $SRCDIR/src/crssync/main.cpp $SRCDIR/src/crssync/qgscrssync.cpp moc_qgsapplication.cpp $SRCDIR/src/core/qgsapplication.cpp -DCORE_EXPORT= -DCOMPILING_CRSSYNC -I$SRCDIR/src/core/ -I$SRCDIR/src/core/geometry -I$BUILDDIR $(pkg-config --cflags --libs Qt5Widgets gdal sqlite3 proj)
109
+ # g++ $optflags -fPIC -o crssync $SRCDIR/src/crssync/main.cpp $SRCDIR/src/crssync/qgscrssync.cpp moc_qgsapplication.cpp $SRCDIR/src/core/qgsapplication.cpp -DCORE_EXPORT= -DCOMPILING_CRSSYNC -I$SRCDIR/src/core/ -I$SRCDIR/src/core/geometry -I$BUILDDIR $(pkg-config --cflags --libs Qt5Widgets gdal sqlite3 proj)
108
110
# )
109
111
# crssync needs X at runtime
110
112
# Xvfb :99 &
111
113
# export DISPLAY=:99
112
114
113
- mingw$bits -make -C$BUILDDIR -j$NJOBS DESTDIR=" ${installroot} " install VERBOSE=1
115
+ mingw$bits -make -C$BUILDDIR -j$njobs DESTDIR=" ${installroot} " install VERBOSE=1
114
116
115
117
# Remove plugins with missing dependencies
116
- rm -rf ${installroot} /share/qgis/python/plugins/{MetaSeARCH ,processing}
118
+ rm -rf ${installroot} /share/qgis/python/plugins/{MetaSearch ,processing}
117
119
118
- # Strip DEBUGinfo
120
+ # Strip debuginfo
119
121
binaries=$( find $installprefix -name ' *.exe' -or -name ' *.dll' -or -name ' *.pyd' )
120
122
for f in $binaries
121
123
do
122
- case $( mingw-objdump -h $f 2> /dev/null | egrep -o ' (DEBUG [\.a-z_]*|gnu.version)' ) in
123
- * DEBUGlink * ) continue ;;
124
- * DEBUG * ) ;;
124
+ case $( mingw-objdump -h $f 2> /dev/null | egrep -o ' (debug [\.a-z_]*|gnu.version)' ) in
125
+ * debuglink * ) continue ;;
126
+ * debug * ) ;;
125
127
* gnu.version* )
126
128
echo " WARNING: $( basename $f ) is already stripped!"
127
129
continue
128
130
;;
129
131
* ) continue ;;
130
132
esac
131
133
132
- echo extracting DEBUG info from $f
133
- mingw-objcopy --only-keep-DEBUG $f $f .DEBUG || :
134
+ echo extracting debug info from $f
135
+ mingw-objcopy --only-keep-debug $f $f .debug || :
134
136
pushd $( dirname $f )
135
137
keep_symbols=` mktemp`
136
- mingw-nm $f .DEBUG --format=sysv --defined-only | awk -F \| ' { if ($4 ~ "Function") print $1 }' | sort > " $keep_symbols "
137
- mingw-objcopy --add-gnu-DEBUGlink =` basename $f .DEBUG ` --strip-unneeded ` basename $f ` --keep-symbols=" $keep_symbols " || :
138
+ mingw-nm $f .debug --format=sysv --defined-only | awk -F \| ' { if ($4 ~ "Function") print $1 }' | sort > " $keep_symbols "
139
+ mingw-objcopy --add-gnu-debuglink =` basename $f .debug ` --strip-unneeded ` basename $f ` --keep-symbols=" $keep_symbols " || :
138
140
rm -f " $keep_symbols "
139
141
popd
140
142
done
@@ -160,7 +162,7 @@ function linkDep {
160
162
lnk " $MINGWROOT /$1 " " $destdir /$name " || return 1
161
163
echo " ${2:- bin} /$name : $( rpm -qf " $MINGWROOT /$1 " ) " >> $installprefix /origins.txt
162
164
autoLinkDeps " $destdir /$name " " ${indent} " || return 1
163
- [ -e " $MINGWROOT /$1 .DEBUG " ] && lnk " $MINGWROOT /$1 .DEBUG " " $destdir /$name .DEBUG " || ($DEBUG && echo " Warning: missing $name .DEBUG " || :)
165
+ [ -e " $MINGWROOT /$1 .debug " ] && lnk " $MINGWROOT /$1 .debug " " $destdir /$name .debug " || ($debug && echo " Warning: missing $name .debug " || :)
164
166
return 0
165
167
}
166
168
@@ -243,7 +245,7 @@ cat $installprefix/origins.txt | sort | uniq > $installprefix/origins.new && mv
243
245
# Create package
244
246
DISTROOT=build_mingw64/dist/usr/x86_64-w64-mingw32/sys-root/mingw
245
247
DEBUGROOT=dist_debug
246
- for file in $( find $DISTROOT -name ' *.DEBUG ' \( -type l -or -type f \) ) ; do
248
+ for file in $( find $DISTROOT -name ' *.debug ' \( -type l -or -type f \) ) ; do
247
249
dest=${file/ $DISTROOT / $DEBUGROOT }
248
250
mkdir -p " $( dirname $dest ) "
249
251
sudo mv " $file " " $dest "
0 commit comments