Skip to content

Commit

Permalink
Noux: add noux-pkg/lynx
Browse files Browse the repository at this point in the history
Explanation why --disable-rpath-hack is needed:

When building on pistachio_x86 $(LDFLAGS) contains '-L[...]/l4/lib'
which will be transformed by autoconf to '-rpath [...]/l4/lib'.
Now the problem at hand is that we pretend to be FreeBSD when we are
actually not. So autoconf assumes it is valid to use '-path'  when it
is actually not.

Also we use zlib for (de)compressing gzipped streams/files instead of
calling gzip as this currently somewhat buggy.
  • Loading branch information
Josef Söntgen authored and nfeske committed Aug 22, 2012
1 parent 42c259d commit 6aa05e8
Show file tree
Hide file tree
Showing 4 changed files with 269 additions and 0 deletions.
19 changes: 19 additions & 0 deletions ports/ports/lynx.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
LYNX = lynx-2.8.8.dev12
LYNX_TGZ = $(LYNX).tar.gz
LYNX_URL = http://lynx.isc.org/gnumatic/$(LYNX_TGZ)
#
# Interface to top-level prepare Makefile
#
PORTS += $(LYNX)

prepare:: $(CONTRIB_DIR)/$(LYNX)

#
# Port-specific local rules
#
$(DOWNLOAD_DIR)/$(LYNX_TGZ):
$(VERBOSE)wget -c -P $(DOWNLOAD_DIR) -O $@ $(LYNX_URL) && touch $@

$(CONTRIB_DIR)/$(LYNX): $(DOWNLOAD_DIR)/$(LYNX_TGZ)
$(VERBOSE)tar xfz $< -C $(CONTRIB_DIR) && touch $@
$(VERBOSE)patch -d contrib/ -N -p0 < src/noux-pkg/lynx/build.patch
204 changes: 204 additions & 0 deletions ports/run/noux_net_lynx_interactive.run
Original file line number Diff line number Diff line change
@@ -0,0 +1,204 @@
if {![have_spec x86]} {
puts "\nThis runscript is supported on the x86 architecture only\n"
exit 0
}

#
# Uncomment the following line when working on the VIM source code. Otherwise,
# the package may get recompiled, yet it does not get reinstalled into 'bin/'.
#
#exec rm -rf noux-pkg/bash bin/bash

set build_components {
core init drivers/timer
noux/net lib/libc_noux
drivers/framebuffer drivers/pci drivers/input
drivers/nic
drivers/timer
server/terminal server/ram_fs
test/libports/ncurses
test/libports/readline
test/libports/zlib
}

#
# Build Noux packages only once
#
set noux_pkgs "bash coreutils lynx noux-etc"

foreach pkg $noux_pkgs {
lappend_if [expr ![file exists bin/$pkg]] build_components noux-pkg/$pkg }

build $build_components

# strip all binaries prior archiving
set find_args ""
foreach pkg $noux_pkgs { append find_args " bin/$pkg/" }
exec sh -c "find $find_args -type f | (xargs [cross_dev_prefix]strip || true) 2>/dev/null"

# add bash as sh
exec cp bin/bash/bin/bash bin/bash/bin/sh

foreach pkg $noux_pkgs {
exec tar cfv bin/$pkg.tar -h -C bin/$pkg . }

create_boot_directory

append config {
<config verbose="yes">
<parent-provides>
<service name="ROM"/>
<service name="LOG"/>
<service name="CAP"/>
<service name="RAM"/>
<service name="RM"/>
<service name="CPU"/>
<service name="PD"/>
<service name="IRQ"/>
<service name="IO_PORT"/>
<service name="IO_MEM"/>
<service name="SIGNAL"/>
</parent-provides>
<default-route>
<any-service> <any-child/> <parent/> </any-service>
</default-route>
<start name="timer">
<resource name="RAM" quantum="1M"/>
<provides><service name="Timer"/></provides>
</start> }

append_if [have_spec sdl] config {
<start name="fb_sdl">
<resource name="RAM" quantum="4M"/>
<provides>
<service name="Input"/>
<service name="Framebuffer"/>
</provides>
</start>}

append_if [have_spec pci] config {
<start name="pci_drv">
<resource name="RAM" quantum="1M"/>
<provides><service name="PCI"/></provides>
</start>}

append_if [have_spec vesa] config {
<start name="vesa_drv">
<resource name="RAM" quantum="1M"/>
<provides><service name="Framebuffer"/></provides>
</start>}

append_if [have_spec pl11x] config {
<start name="pl11x_drv">
<resource name="RAM" quantum="2M"/>
<provides><service name="Framebuffer"/></provides>
</start>}

append_if [have_spec ps2] config {
<start name="ps2_drv">
<resource name="RAM" quantum="1M"/>
<provides><service name="Input"/></provides>
</start> }

append config {
<start name="terminal">
<resource name="RAM" quantum="2M"/>
<provides><service name="Terminal"/></provides>
<config>
<keyboard layout="us"/>
</config>
</start>
<start name="nic_drv">
<resource name="RAM" quantum="4M"/>
<provides> <service name="Nic"/> </provides>
</start>
<start name="ram_fs">
<resource name="RAM" quantum="10M"/>
<provides><service name="File_system"/></provides>
<config>
<content>
<dir name="tmp">
</dir>
<dir name="home">
</dir>
</content>
<policy label="noux -> root" root="/" />
<policy label="noux -> home" root="/home" writeable="yes" />
<policy label="noux -> tmp" root="/tmp" writeable="yes" />
</config>
</start>
<start name="noux">
<binary name="noux_net" />
<resource name="RAM" quantum="1G" />
<config>
<user name="lynx_user" uid="3" gid="3">
<shell name="/bin/bash" />
<home name="/home" />
</user>
<fstab>
}

foreach pkg $noux_pkgs {
append config " <tar name=\"$pkg.tar\" />" }

append config {
<dir name="home">
<fs label="home" />
</dir>
<dir name="ram"> <fs label="root" /> </dir>
<dir name="tmp"> <fs label="tmp" /> </dir>

<dir name="dev">
<null />
<zero />
</dir>

</fstab>
<start name="/bin/bash">
<env name="TERM" value="linux" />
</start>
</config>
</start>
</config>
}

install_config $config


#
# Boot modules
#

# generic modules
set boot_modules {
core init timer ld.lib.so noux_net nic_drv terminal ram_fs
libc.lib.so libm.lib.so libc_noux.lib.so libc_resolv.lib.so
lwip.lib.so ncurses.lib.so
readline.lib.so zlib.lib.so libcrypto.lib.so libssl.lib.so
}

foreach pkg $noux_pkgs {
lappend boot_modules "$pkg.tar" }

# platform-specific modules
lappend_if [have_spec linux] boot_modules fb_sdl
lappend_if [have_spec pci] boot_modules pci_drv
lappend_if [have_spec vesa] boot_modules vesa_drv
lappend_if [have_spec ps2] boot_modules ps2_drv
lappend_if [have_spec pl11x] boot_modules pl11x_drv

build_boot_image $boot_modules

if {[have_spec x86_64]} {
# bash.tar is really huge when built for x86_64
append qemu_args " -m 320 "
}

append_if [have_spec x86] qemu_args " -net nic,model=e1000"
append_if [have_spec lan9118] qemu_args " -net nic,model=lan9118 "

append qemu_args " -net user "

run_genode_until forever

#exec rm bin/bash.tar
11 changes: 11 additions & 0 deletions ports/src/noux-pkg/lynx/build.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- lynx-2.8.8.dev12.orig/src/makefile.in 2012-06-18 15:44:22.237274112 +0200
+++ lynx-2.8.8.dev12/src/makefile.in 2012-06-18 15:44:37.774023653 +0200
@@ -102,7 +102,7 @@

lynx$x: message do_chartrans_stuff $(top_builddir)/LYHelp.h $(OBJS) $(WWWLIB)
@echo "Linking and creating Lynx executable"
- $(CC) $(CC_OPTS) $(LDFLAGS) -o $@ $(OBJS) $(WWWLIB) $(LDFLAGS) $(LIBS) $(INTLLIB)
+ $(CC) $(CC_OPTS) $(LDFLAGS) -o $@ $(OBJS) $(WWWLIB) $(LIBS) $(INTLLIB)
@echo "Copying Lynx executable into top-level directory"
rm -f $(top_builddir)/$@
cp $@ $(top_builddir)/
35 changes: 35 additions & 0 deletions ports/src/noux-pkg/lynx/target.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
NOUX_CONFIGURE_ARGS = --with-ssl \
--with-zlib \
--disable-nls \
--disable-ipv6 \
--disable-rpath-hack \
--with-cfg-file=/etc/lynx.cfg \
--with-lss-file=/etc/lynx.lss

#
# Needed for <sys/types.h>
#
NOUX_CFLAGS += -D__BSD_VISIBLE

LIBS += ncurses zlib libssl libc_resolv

#
# Make the zlib linking test succeed
#
Makefile: dummy_libs

NOUX_LDFLAGS += -L$(PWD)

dummy_libs: libcrypto.a libssl.a libz.a

libcrypto.a:
$(VERBOSE)$(AR) -rc $@

libssl.a:
$(VERBOSE)$(AR) -rc $@

libz.a:
$(VERBOSE)$(AR) -rc $@


include $(REP_DIR)/mk/noux.mk

0 comments on commit 6aa05e8

Please sign in to comment.