Skip to content

Commit

Permalink
Enable GDB TUI support via PDCurses
Browse files Browse the repository at this point in the history
This introduces yet another dependency, but it's a substantial gain for
a small cost.

GDB lacks "--with-libcurses-prefix" so I had to manually list the path
in LDFLAGS. Otherwise the GDB configure script fails to find waddstr and
gives up even though actually linking gdb.exe works fine without it.

The capitalized file name for PDCurses introduces a small sorting issue
in SHA256SUMS. Lexicographic collation with PDCurses at the top? A more
natural collation with PDCurses in the middle? I generate the listing
via "sha256sum *" in Bash, and in my locale Bash uses the latter, so
that's what I'll use.
  • Loading branch information
skeeto committed Nov 1, 2022
1 parent 34945ff commit 5f3d7b8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
16 changes: 13 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ ARG MINGW_VERSION=10.0.0
ARG MPC_VERSION=1.2.1
ARG MPFR_VERSION=4.1.0
ARG NASM_VERSION=2.15.05
ARG PDCURSES_VERSION=3.9
ARG CPPCHECK_VERSION=2.8
ARG VIM_VERSION=9.0

Expand All @@ -36,6 +37,7 @@ RUN curl --insecure --location --remote-name-all --remote-header-name \
https://www.nasm.us/pub/nasm/releasebuilds/$NASM_VERSION/nasm-$NASM_VERSION.tar.xz \
https://deb.debian.org/debian/pool/main/u/universal-ctags/universal-ctags_0+git$CTAGS_VERSION.orig.tar.gz \
https://downloads.sourceforge.net/project/mingw-w64/mingw-w64/mingw-w64-release/mingw-w64-v$MINGW_VERSION.tar.bz2 \
https://downloads.sourceforge.net/project/pdcurses/pdcurses/$PDCURSES_VERSION/PDCurses-$PDCURSES_VERSION.tar.gz \
https://github.com/danmar/cppcheck/archive/$CPPCHECK_VERSION.tar.gz
COPY src/SHA256SUMS $PREFIX/src/
RUN sha256sum -c $PREFIX/src/SHA256SUMS \
Expand All @@ -50,6 +52,7 @@ RUN sha256sum -c $PREFIX/src/SHA256SUMS \
&& tar xJf mpfr-$MPFR_VERSION.tar.xz \
&& tar xzf make-$MAKE_VERSION.tar.gz \
&& tar xjf mingw-w64-v$MINGW_VERSION.tar.bz2 \
&& tar xzf PDCurses-$PDCURSES_VERSION.tar.gz \
&& tar xJf nasm-$NASM_VERSION.tar.xz \
&& tar xjf vim-$VIM_VERSION.tar.bz2 \
&& tar xzf cppcheck-$CPPCHECK_VERSION.tar.gz
Expand Down Expand Up @@ -315,15 +318,22 @@ RUN /expat-$EXPAT_VERSION/configure \
&& make -j$(nproc) \
&& make install

WORKDIR /PDCurses-$PDCURSES_VERSION
RUN make -j$(nproc) -C wincon \
CFLAGS="-I.. -Os -DPDC_WIDE" CC=$ARCH-gcc pdcurses.a \
&& cp wincon/pdcurses.a /deps/lib/libcurses.a \
&& cp curses.h /deps/include

WORKDIR /gdb
RUN sed -i 's/quiet = 0/quiet = 1/' /gdb-$GDB_VERSION/gdb/main.c \
&& /gdb-$GDB_VERSION/configure \
--host=$ARCH \
--with-libexpat-prefix=/deps \
--with-libgmp-prefix=/deps \
CFLAGS="-Os -D_WIN32_WINNT=0x502" \
CXXFLAGS="-Os" \
LDFLAGS="-s" \
--enable-tui \
CFLAGS="-Os -D_WIN32_WINNT=0x502 -DPDC_WIDE" \
CXXFLAGS="-Os -DPDC_WIDE" \
LDFLAGS="-s -L/deps/lib" \
&& make MAKEINFO=true -j$(nproc) \
&& cp gdb/gdb.exe $PREFIX/bin/

Expand Down
1 change: 1 addition & 0 deletions src/SHA256SUMS
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ ba6b430aed72c63a3768531f6a3ffc2b0fde2c57a3b251450dcf489a894f0894 mingw-w64-v10.
17503d2c395dfcf106b622dc142683c1199431d095367c6aacba6eec30340459 mpc-1.2.1.tar.gz
0c98a3f1732ff6ca4ea690552079da9c597872d30e96ec28414ee23c95558a7f mpfr-4.1.0.tar.xz
3caf6729c1073bf96629b57cee31eeb54f4f8129b01902c73428836550b30a3f nasm-2.15.05.tar.xz
590dbe0f5835f66992df096d3602d0271103f90cf8557a5d124f693c2b40d7ec PDCurses-3.9.tar.gz
d2e851f5c51744c4e175200bc1ac7a2e9cab18aa6b9f8aabdffeacdf8324b94d universal-ctags_0+git20200824.orig.tar.gz
a6456bc154999d83d0c20d968ac7ba6e7df0d02f3cb6427fb248660bacfb336e vim-9.0.tar.bz2

0 comments on commit 5f3d7b8

Please sign in to comment.