Skip to content

Commit dc882d9

Browse files
authored
Merge pull request #14 from guyush1/enable-tui-statically
add tui to gdb
2 parents d5e1dbb + d55a31b commit dc882d9

File tree

3 files changed

+66
-1
lines changed

3 files changed

+66
-1
lines changed

Dockerfile

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ RUN apt update && apt install -y \
1414
gcc-mips-linux-gnu \
1515
gcc-mipsel-linux-gnu \
1616
gcc-powerpc-linux-gnu \
17+
libncurses-dev \
1718
m4 \
1819
make \
1920
patch \

src/build.sh

+64-1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,17 @@ function set_compliation_variables() {
5151
export CXXFLAGS="-O2"
5252
}
5353

54+
function set_ncurses_link_variables() {
55+
# Set up ncurses library link variables
56+
#
57+
# Parameters:
58+
# $1: ncursesw build dir
59+
local ncursesw_build_dir="$1"
60+
61+
# Allow tui mode by adding our custom built static ncursesw library to the linker search path.
62+
export LDFLAGS="-L$ncursesw_build_dir/lib $LDFLAGS"
63+
}
64+
5465
function build_iconv() {
5566
# Build libiconv.
5667
#
@@ -152,6 +163,51 @@ function build_libgmp() {
152163
popd > /dev/null
153164
}
154165

166+
function build_ncurses() {
167+
# Build libncursesw.
168+
#
169+
# Parameters:
170+
# $1: libncursesw package directory
171+
# $2: target architecture
172+
#
173+
# Echoes:
174+
# The libncursesw build directory
175+
#
176+
# Returns:
177+
# 0: success
178+
# 1: failure
179+
local ncurses_dir="$1"
180+
local target_arch="$2"
181+
local ncurses_build_dir="$(realpath "$ncurses_dir/build-$target_arch")"
182+
183+
echo "$ncurses_build_dir"
184+
mkdir -p "$ncurses_build_dir"
185+
186+
if [[ -f "$ncurses_build_dir/lib/libncursesw.a" ]]; then
187+
>&2 echo "Skipping build: libncursesw already built for $target_arch"
188+
return 0
189+
fi
190+
191+
pushd "$ncurses_build_dir" > /dev/null
192+
193+
>&2 fancy_title "Building libncursesw for $target_arch"
194+
195+
../configure --enable-static "CC=$CC" "CXX=$CXX" "--host=$HOST" \
196+
"CFLAGS=$CFLAGS" "CXXFLAGS=$CXXFLAGS" "--enable-widec" 1>&2
197+
if [[ $? -ne 0 ]]; then
198+
return 1
199+
fi
200+
201+
make -j$(nproc) 1>&2
202+
if [[ $? -ne 0 ]]; then
203+
return 1
204+
fi
205+
206+
>&2 fancy_title "Finished building libncursesw for $target_arch"
207+
208+
popd > /dev/null
209+
}
210+
155211
function build_libmpfr() {
156212
# Build libmpfr.
157213
#
@@ -242,7 +298,7 @@ function build_gdb() {
242298

243299
>&2 fancy_title "Building gdb for $target_arch"
244300

245-
../configure --enable-static --with-static-standard-libraries --disable-tui --disable-inprocess-agent \
301+
../configure --enable-static --enable-tui --with-static-standard-libraries --disable-inprocess-agent \
246302
"--with-libiconv-prefix=$libiconv_prefix" --with-libiconv-type=static \
247303
"--with-gmp=$libgmp_prefix" \
248304
"--with-mpfr=$libmpfr_prefix" \
@@ -367,6 +423,13 @@ function build_gdb_with_dependencies() {
367423
return 1
368424
fi
369425

426+
ncursesw_build_dir="$(build_ncurses "$packages_dir/ncurses" "$target_arch")"
427+
if [[ $? -ne 0 ]]; then
428+
return 1
429+
fi
430+
431+
set_ncurses_link_variables "$ncursesw_build_dir"
432+
370433
build_and_install_gdb "$packages_dir/gdb" \
371434
"$iconv_build_dir/lib/.libs/" \
372435
"$gmp_build_dir/.libs/" \

src/download_packages.sh

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ PACKAGE_URLS=(
1010
"https://ftp.gnu.org/pub/gnu/gmp/gmp-6.3.0.tar.xz"
1111
"https://ftp.gnu.org/pub/gnu/mpfr/mpfr-4.2.1.tar.xz"
1212
"https://ftp.gnu.org/gnu/gdb/gdb-15.2.tar.xz"
13+
"https://ftp.gnu.org/pub/gnu/ncurses/ncurses-6.5.tar.gz"
1314
)
1415

1516
function unpack_tarball() {

0 commit comments

Comments
 (0)