From 06378cb509ae72cccc1fe1cbf0e9a378ee7139b1 Mon Sep 17 00:00:00 2001 From: Daniel Silverstone Date: Sat, 20 Apr 2013 07:07:12 +0100 Subject: working to some extent --- basis.mk | 39 +++++++++++++++ prep-source-all.pl | 143 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 182 insertions(+) create mode 100644 basis.mk create mode 100644 prep-source-all.pl diff --git a/basis.mk b/basis.mk new file mode 100644 index 0000000..1358f39 --- /dev/null +++ b/basis.mk @@ -0,0 +1,39 @@ +#!/bin/make +# +# NetSurf Source makefile for libraries and browser + +export TARGET ?= gtk +export PKG_CONFIG_PATH = $(TMP_PREFIX)/lib/pkgconfig +TMP_PREFIX := $(CURDIR)/prefix-$(TARGET) + +###TARGS### + +define do_clean + $(MAKE) distclean --directory=$1 TARGET=$(TARGET) + +endef + +define do_prefix_install + $(MAKE) install --directory=$1 TARGET=$(TARGET) PREFIX=$(TMP_PREFIX) DESTDIR= + +endef + + +.PHONY: build install clean + +build: $(TMP_PREFIX)/build-stamp + +$(TMP_PREFIX)/build-stamp: + mkdir -p $(TMP_PREFIX)/include + mkdir -p $(TMP_PREFIX)/lib + $(foreach L,$(NSLIBTARG),$(call do_prefix_install,$(L))) + $(MAKE) --directory=$(NETSURF_TARG) PREFIX=$(PREFIX) TARGET=$(TARGET) + touch $@ + +install: $(TMP_PREFIX)/build-stamp + $(MAKE) install --directory=$(NETSURF_TARG) TARGET=$(TARGET) PREFIX=$(PREFIX) DESTDIR=$(DESTDIR) + +clean: + $(RM) -r $(TMP_PREFIX) + $(foreach L,$(NSLIBTARG),$(call do_clean,$(L))) + $(MAKE) clean --directory=$(NETSURF_TARG) TARGET=$(TARGET) diff --git a/prep-source-all.pl b/prep-source-all.pl new file mode 100644 index 0000000..0bed9c7 --- /dev/null +++ b/prep-source-all.pl @@ -0,0 +1,143 @@ +#!/usr/bin/perl -w + +use strict; + +my @repos_in_order = qw( + buildsystem + libwapcaplet + libparserutils + libcss + libhubbub + libdom + libnsbmp + libnsgif + librosprite + libnsfb + libsvgtiny + nsgenjsbind + netsurf + ); + +my %repos = ( + buildsystem => "buildsystem", + libwapcaplet => "libwapcaplet", + libparserutils => "libparserutils", + libcss => "libcss", + libhubbub => "libhubbub", + libdom => "libdom", + libnsbmp => "libnsbmp", + libnsgif => "libnsgif", + librosprite => "librosprite", + libnsfb => "libnsfb", + libsvgtiny => "libsvgtiny", + nsgenjsbind => "nsgenbind", + rufl => "librufl", + libpencil => "libpencil", + netsurf => "netsurf", + ); + +my %vers = (); + +foreach my $arg (@ARGV) { + $arg =~ /^([^=]+)=(.*)$/; + $vers{$1} = $2; + print "Memoising $1 = $2\n"; +} + +# Utility functions + +sub repourl { + my $repo = shift; + return "git://git.netsurf-browser.org/${repo}.git"; +} + +sub tarurl { + my $repo = shift; + return "http://ci.netsurf-browser.org/builds/sources/$repos{${repo}}-$vers{${repo}}.tar.gz"; +} + +sub tarfile { + my $repo = shift; + return "tars/$repos{${repo}}-$vers{${repo}}.tar.gz"; +} + +`mkdir -p gits tars`; + +# Step 1, acquire the versions of all the repos in order + +foreach my $repo (keys %repos) { + if (defined $vers{$repo}) { + print "Assuming $repo is at $vers{$repo}\n"; + } else { + print "Interrogating ${repo}...\n"; + my $url = repourl($repo); + system("git clone $url gits/$repo") unless (-d "gits/$repo"); + system("cd gits/$repo; git remote update origin"); + my $ver = `cd gits/$repo; git describe --abbrev=0 origin/master`; + chomp $ver; + $ver =~ s/^release\///; + $vers{$repo} = $ver; + print "Determined $repo is at $vers{$repo}\n"; + } +} + +# Step 2, acquire the tarballs + +foreach my $repo (keys %repos) { + next if ($vers{$repo} eq ''); + print "Acquiring tar for $repo\n"; + my $url = tarurl($repo); + my $file = tarfile($repo); + system("wget -O $file $url") unless (-r $file); +} + +# Step 3, prepare the tar + +`rm -rf netsurf-all-$vers{netsurf}`; + +`mkdir -p netsurf-all-$vers{netsurf}/src`; + +foreach my $repo (keys %repos) { + next if ($vers{$repo} eq ''); + print "Unpacking $repo\n"; + my $file = tarfile($repo); + system("cd netsurf-all-$vers{netsurf}/src; tar xzf ../../$file"); +} + +# Step 4, prepare top level Makefile + +open INFILE, "<", "basis.mk"; +open OUTFILE, ">", "netsurf-all-$vers{netsurf}/Makefile"; + +while (my $line = ) { + unless ($line =~ /^###([^#]+)###$/) { + print OUTFILE $line; + next; + } + my $what = $1; + if ($what eq 'TARGS') { + my $libtargs = ""; + foreach my $repo (@repos_in_order) { + next if ($vers{$repo} eq ''); + my $basis = $repos{$repo}; + my $ver = $vers{$repo}; + $repo =~ y/a-z/A-Z/; + print OUTFILE "${repo}_BASE := src/$basis\n"; + print OUTFILE "${repo}_VERS := $ver\n"; + print OUTFILE "${repo}_TARG := \$(${repo}_BASE)-\$(${repo}_VERS)\n"; + print OUTFILE "\n"; + unless ($repo eq 'NETSURF') { + $libtargs .= " \$(${repo}_TARG)"; + } + } + print OUTFILE "NSLIBTARG :=$libtargs\n"; + print OUTFILE "\n"; + } +} + +close OUTFILE; +close INFILE; + +print "Tarring it all up\n"; +`tar czf netsurf-all-$vers{netsurf}.tar.gz netsurf-all-$vers{netsurf}`; + -- cgit v1.2.3