From 66198660aaf759de2c74b98bddfebe28c47640f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20S=C3=B6ntgen?= Date: Thu, 16 Aug 2012 08:41:24 +0200 Subject: [PATCH] Noux: add noux_net_lighttpd.run This patch adds lighttpd as noux package. However, we do not use the original build system but rather compile lighttpd directly from the Genode build system. This is needed because we want to statically link lighttpd modules into the binary. This mode is (somehow) supported by the SConscript that comes with lighttpd. However, the GNU build scripts do not expose this feature. --- ports/run/noux_net_lighttpd.run | 247 ++++++++++++++++++++++++++ ports/src/noux-pkg/lighttpd/target.mk | 28 +-- 2 files changed, 252 insertions(+), 23 deletions(-) create mode 100644 ports/run/noux_net_lighttpd.run diff --git a/ports/run/noux_net_lighttpd.run b/ports/run/noux_net_lighttpd.run new file mode 100644 index 0000000000..dd0f1aa808 --- /dev/null +++ b/ports/run/noux_net_lighttpd.run @@ -0,0 +1,247 @@ +if {![have_spec x86]} { + puts "\nThis runscript is supported on the x86 architecture only\n" + exit 0 +} + +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 + noux-pkg/lighttpd +} + +# +# Build Noux packages only once +# +set noux_pkgs "bash coreutils vim" + +foreach pkg $noux_pkgs { + lappend_if [expr ![file exists bin/$pkg]] build_components noux-pkg/$pkg } + +build $build_components + +set vimrc_fd [open "bin/vim/share/vim/vimrc" w] +puts $vimrc_fd { +set noloadplugins +set hls +set nocompatible +set laststatus=2 +set noswapfile +set viminfo=} +close $vimrc_fd + +# 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 cf bin/$pkg.tar -h -C bin/$pkg . } + +# generate configuration for lighttpd +proc lighttpd_config_path { } { + return "[genode_dir]/ports/contrib/lighttpd-1.4.31/doc/config" } + +exec mkdir -p bin/aux/etc/lighttpd +exec sh -c "cp [lighttpd_config_path]/*.conf bin/aux/etc/lighttpd" +exec sh -c "cp -r [lighttpd_config_path]/conf.d bin/aux/etc/lighttpd" +exec tar cvf bin/aux.tar -h -C bin/aux . + +exec tar cf bin/lighttpd.tar -h -C noux-pkg/lighttpd lighttpd_noux + +set noux_pkgs "$noux_pkgs aux" + +create_boot_directory + +append config { + + + + + + + + + + + + + + + + + + + + + } + +append_if [have_spec sdl] config { + + + + + + + } + +append_if [have_spec pci] config { + + + + } + +append_if [have_spec vesa] config { + + + + } + +append_if [have_spec pl11x] config { + + + + } + +append_if [have_spec ps2] config { + + + + } + +append config { + + + + + + + + + + + + + + + + + + + + + + Hello + + +

Hello Genode!

+ I am bold ;-) + + +
+
+ + + lighttpd_noux -f /etc/lighttpd/lighttpd.conf -D; + + + + + + + + + + + + + + + + + + +} + +foreach pkg $noux_pkgs { + append config " " } + +append 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 + lwip.lib.so ncurses.lib.so + readline.lib.so zlib.lib.so libcrypto.lib.so libssl.lib.so + lighttpd.tar +} + +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 -redir tcp:5555::80 " + +run_genode_until forever + +#exec rm bin/bash.tar +exec rm -rf bin/aux diff --git a/ports/src/noux-pkg/lighttpd/target.mk b/ports/src/noux-pkg/lighttpd/target.mk index 0609784dce..945c91e5b4 100644 --- a/ports/src/noux-pkg/lighttpd/target.mk +++ b/ports/src/noux-pkg/lighttpd/target.mk @@ -1,26 +1,8 @@ -TARGET = lighttpd +TARGET = lighttpd_noux -NOUX_CONFIGURE_ARGS += --disable-ipv6 \ - --disable-mmap \ - --without-bzip2 \ - --without-pcre +include $(REP_DIR)/src/app/lighttpd/target.inc -LIBS += libcrypto libssl zlib #libc_resolv +# search path for 'plugin-static.h' +INC_DIR += $(REP_DIR)/src/app/lighttpd -# -# Make the zlib linking test succeed -# -Makefile: dummy_libs - -NOUX_LDFLAGS += -L$(PWD) - -dummy_libs: libz.a libcrypto.a libssl.a - -libcrypto.a: - $(VERBOSE)$(AR) -rc $@ -libssl.a: - $(VERBOSE)$(AR) -rc $@ -libz.a: - $(VERBOSE)$(AR) -rc $@ - -include $(REP_DIR)/mk/noux.mk +LIBS += libc_noux