Re: Request for help: slashem
Hi Helmut,
On Tue, Mar 16, 2021 at 06:46:16PM +0100, Helmut Grohne wrote:
> Hi Nilesh,
>
> On Tue, Mar 16, 2021 at 07:42:56PM +0530, Nilesh Patra wrote:
> > I am trying to make slashem cross-buildable.
> > I did the following:
> >
> > * It was using the build
> > arch's compiler, so I passed it to make in d/rules
> >
> > * Since it looks like upstream is dead(no new version since 2004), I mitigated uname -S for time
> > being and passed the flags meant for unix system
> >
> > * Now this was failing with: "../win/gtk/gtkgetlin.c:12:10: fatal error:
> > gtk/gtk.h: No such file or directory" error, so I suspected pkg-config
> > is at fault.
> > So I went ahead and attempted to not pass hard-coded
> > pkg-config. However, even after this change it ends up with:
> >
> > Package gtk+-2.0 was not found in the pkg-config search path.
> > Perhaps you should add the directory containing `gtk+-2.0.pc'
> > to the PKG_CONFIG_PATH environment variable
> > No package 'gtk+-2.0' found
> > In file included from ../win/gtk/gtk.c:19:
> > ../include/winGTK.h:8:10: fatal error: gtk/gtk.h: No such file or directory
> > 8 | #include <gtk/gtk.h>
> > | ^~~~~~~~~~~
> >
> > which looks weird. and this is where I'm stuck for now. I'm attaching my
> > patch with this e-mail. Please consider taking a look, any help is appreciated.
>
> All of what you write seems right. You made pkg-config substitutable,
> but you did not supply a substitution for PKG_CONFIG. You do not use
> dh_auto_build (which would pass it). You do not explicitly pass
> PKG_CONFIG=... to make. You do not export PKG_CONFIG explicitly. You do
> not let dpkg's buildtools.mk export PKG_CONFIG by setting
> DPKG_EXPORT_BUILDTOOLS=nonempty. As a consequence, yes it is using the
> build architecture pkg-config.
>
> I think the simplest of all would be using dh_auto_build.
Right. This was me being plain stupid here. I tried with dh_* options
everywhere, the cross build works fine on my machine
However, there are several of: ERROR: ld.so: object 'libfakeroot-sysv.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
Not sure if it is okay, probably it is not.
I'm attaching my patch along, please consider taking a look.
Nilesh
diff --git a/debian/patches/cross.patch b/debian/patches/cross.patch
new file mode 100644
index 0000000..85045cd
--- /dev/null
+++ b/debian/patches/cross.patch
@@ -0,0 +1,42 @@
+--- a/sys/unix/Makefile.src
++++ b/sys/unix/Makefile.src
+@@ -1,6 +1,3 @@
+-# Determine kernel name
+-UNAME := $(shell uname -s)
+-
+ # NetHack Makefile.
+ # SCCS Id: @(#)Makefile.src 3.4 2002/03/02
+
+@@ -128,12 +125,9 @@
+ # flags for Linux and kFreeBSD
+ # compile normally
+ # disable optimization on non-Linux archs due to FTBFS
+-ifeq ($(UNAME),Linux)
+ CFLAGS = -DDEBIAN_$(GUI) -O2 -fomit-frame-pointer -fstack-protector -fcommon --param=ssp-buffer-size=4 -I../include -I/usr/X11R6/include
+-else
+-CFLAGS = -DDEBIAN_$(GUI) -fstack-protector -fcommon --param=ssp-buffer-size=4 -I../include -I/usr/X11R6/include
+-endif
+ LFLAGS = -L/usr/X11R6/lib -Wl,-z,relro
++PKG_CONFIG ?= pkg-config
+ # OR compile backwards compatible a.out format
+ # CFLAGS = -O2 -b i486-linuxaout -fomit-frame-pointer -I../include -I/usr/X11/include
+ # LFLAGS = -b i486-linuxaout -L/usr/X11/lib
+@@ -198,8 +192,7 @@
+ #LINK=arm-linux-gcc
+
+ # GTK windowing system
+-WINGTKCONFIG=PKG_CONFIG_PATH=/usr/devel/lib/pkgconfig pkg-config gtk+-2.0
+-WINGTKCFLAGS=`$(WINGTKCONFIG) --cflags`
++WINGTKCFLAGS=`$(PKG_CONFIG) gtk+-2.0 --cflags`
+
+ # Set the WINSRC, WINOBJ, and WINLIB lines to correspond to your desired
+ # combination of windowing systems. Also set windowing systems in config.h.
+@@ -374,7 +367,7 @@
+ WINKDELIB = -lkdecore -lkdeui -lXext
+ #
+ # libraries for GTK
+-WINGTKLIB = `$(WINGTKCONFIG) --libs`
++WINGTKLIB = `$(PKG_CONFIG) gtk+-2.0 --libs`
+ #
+ # libraries for Gnome
+ WINGNOMELIB = -lgnomeui -lgnome -lart_lgpl -lgtk -lgdk -lpopt
diff --git a/debian/patches/series b/debian/patches/series
index 547e86f..4529255 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -4,3 +4,4 @@ slashem-debian.patch
reproducible-build.patch
pointer-truncation-bug-860393.patch
clang_FTBFS_Wreturn-type.patch
+cross.patch
diff --git a/debian/rules b/debian/rules
index 961a6d7..4234b4a 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,5 +1,7 @@
#!/usr/bin/make -f
+-include /usr/share/dpkg/buildtools.mk
+
%:
dh $@
@@ -21,22 +23,22 @@ override_dh_missing:
override_dh_auto_build:
# Copy out the Makefiles
$(SHELL) ./sys/unix/setup.sh foobar
- (cd util ; $(MAKE) recover)
+ dh_auto_build --sourcedirectory=util -- recover
touch include/config.h
- $(MAKE) slashem GUI=TTY
+ dh_auto_build -- slashem GUI=TTY
mv src/slashem slashem-tty
touch include/config.h
- $(MAKE) slashem GUI=X11
+ dh_auto_build -- slashem GUI=X11
mv src/slashem slashem-x11
touch include/config.h
- $(MAKE) slashem GUI=SDL
+ dh_auto_build -- slashem GUI=SDL
mv src/slashem slashem-sdl
touch include/config.h
- $(MAKE) all GUI=GTK
+ dh_auto_build -- GUI=GTK
mv src/slashem slashem-gtk
# touch include/config.h
@@ -45,7 +47,7 @@ override_dh_auto_build:
override_dh_auto_install:
cp slashem-tty src/slashem
- $(MAKE) install PREFIX=$(CURDIR)/debian/tmp
+ dh_auto_install -- PREFIX=$(CURDIR)/debian/tmp CC="$(CC)"
-cp slashem-x11 debian/tmp/usr/games/
-cp slashem-sdl debian/tmp/usr/games/
-cp slashem-gtk debian/tmp/usr/games/
Reply to: