From e9b75793527b326809d92e15901812fb9047c424 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sat, 13 Sep 2003 21:07:32 +0000 Subject: split up interface file to cut down on ram usage #28209 --- net-p2p/dc-gui/ChangeLog | 11 ++- net-p2p/dc-gui/dc-gui-0.75.ebuild | 12 ++- net-p2p/dc-gui/files/split_interface_fast.pl | 126 +++++++++++++++++++++++++++ 3 files changed, 143 insertions(+), 6 deletions(-) create mode 100644 net-p2p/dc-gui/files/split_interface_fast.pl (limited to 'net-p2p') diff --git a/net-p2p/dc-gui/ChangeLog b/net-p2p/dc-gui/ChangeLog index ce7b89c3f1fb..f86fe06ff96b 100644 --- a/net-p2p/dc-gui/ChangeLog +++ b/net-p2p/dc-gui/ChangeLog @@ -1,12 +1,17 @@ # ChangeLog for net-p2p/dc-gui # Copyright 2002-2003 Gentoo Technologies, Inc.; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/net-p2p/dc-gui/ChangeLog,v 1.17 2003/07/24 00:24:01 agenkin Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-p2p/dc-gui/ChangeLog,v 1.18 2003/09/13 21:07:32 vapier Exp $ + +*dc-gui-0.75 (23 Jul 2003) + + 13 Sep 2003; Mike Frysinger : + Added a perl script to split up the interface file. The current one + seems to take like 500+megs of ram to compile. Thanks go out to + Michal 'Spock' Januszewski for the script #28209. 25 Jun 2003; Martin Holzer dc-gui-0.74.ebuild: Fixed DEPEND. Closes #23473. -*dc-gui-0.75 (23 Jul 2003) - 23 Jul 2003; Arcady Genkin : Version bumped. diff --git a/net-p2p/dc-gui/dc-gui-0.75.ebuild b/net-p2p/dc-gui/dc-gui-0.75.ebuild index 8bff1d0c3002..e7c15d54b53f 100644 --- a/net-p2p/dc-gui/dc-gui-0.75.ebuild +++ b/net-p2p/dc-gui/dc-gui-0.75.ebuild @@ -1,8 +1,6 @@ # Copyright 1999-2003 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/net-p2p/dc-gui/dc-gui-0.75.ebuild,v 1.1 2003/07/24 00:24:01 agenkin Exp $ - -IUSE="nls" +# $Header: /var/cvsroot/gentoo-x86/net-p2p/dc-gui/dc-gui-0.75.ebuild,v 1.2 2003/09/13 21:07:32 vapier Exp $ MY_P=${PN/-/_}2-${PV} S=${WORKDIR}/${MY_P} @@ -13,6 +11,7 @@ HOMEPAGE="http://ac2i.tzo.com/dctc/" SLOT="2" LICENSE="GPL-2" KEYWORDS="~x86 ~ppc" +IUSE="nls" DEPEND="=dev-libs/glib-2* =x11-libs/gtk+-2* @@ -21,6 +20,13 @@ DEPEND="=dev-libs/glib-2* >=net-p2p/dctc-0.85.4" RDEPEND="nls? ( sys-devel/gettext )" +src_unpack() { + unpack ${A} + cd ${S}/src + cp ${FILESDIR}/split_interface_fast.pl . + perl split_interface_fast.pl || die "could not split interface up" +} + src_compile() { econf `use_enable nls` || die emake || die diff --git a/net-p2p/dc-gui/files/split_interface_fast.pl b/net-p2p/dc-gui/files/split_interface_fast.pl new file mode 100644 index 000000000000..a13c83b7b85f --- /dev/null +++ b/net-p2p/dc-gui/files/split_interface_fast.pl @@ -0,0 +1,126 @@ +#!/usr/bin/perl +# interface.c splitter for dc_gui2 +# (c) 2003 by Micha³ 'Spock' Januszewski + +open(SRC,"interface_extern.h"); +open(NSRC,">interface_new.c"); + +$maxlines = 500; + +my @temp; +my @objects; + +while ($line = ) { + + if ($line =~ /static ([A-Za-z0-9_\ \[\]]+)/) { + print EXT "extern $1;\n"; + $line =~ s/static//; + } + + push @temp,$line; + last if ($line =~ /create_app1 \(void\)/); +} + +while ($line = ) { + + last if ($line =~ /^\s+$/); + + if ($line =~ /(G[A-Za-z0-9]+ \*[A-Za-z0-9_]+)(.*)/) { + push @objects,"$1$2"; + print EXT "extern $1;\n"; + } +} + +$done = 0; + +$cnt = 0; +$linecnt = 0; +$back = $line; + +while ($line = ) { + + last if ($line =~ /return app1/); + + if ($linecnt == 0) { + open(SPLIT,">interface$cnt.c"); + + print SPLIT "#include \n#include \n#include \n#include \n#include \n"; + print SPLIT "#include \n#include \"callbacks.h\"\n#include \"interface.h\"\n#include \"support.h\"\n#include \"interface_extern.h\"\n"; + print SPLIT "#define GLADE_HOOKUP_OBJECT(component,widget,name) gtk_object_set_data_full (GTK_OBJECT (component), name, gtk_widget_ref (widget), (GtkDestroyNotify) gtk_widget_unref)\n"; + print SPLIT "#define GLADE_HOOKUP_OBJECT_NO_REF(component,widget,name) gtk_object_set_data (GTK_OBJECT (component), name, widget)\n\n"; + print SPLIT "void create_app1_part$cnt (void) {\n\n"; + } + + print SPLIT $line; + $linecnt++; + + if ($linecnt == $maxlines) { + + # we don't want an unfinished line to be broken between two functions + while ($line !~ /;\s*\n$/) { + $line = ; + print SPLIT $line; + } + + $linecnt = 0; + print SPLIT " return;\n}\n"; + close(SPLIT); + $cnt++; + } +} +print SPLIT " return;\n}\n"; +close(SPLIT); + +while ($dat = shift @temp) { + if ($dat =~ /^GtkWidget*/ && !$done) { + for ($i = 0; $i < $#objects+1; $i++) { + print NSRC $objects[$i]."\n"; + } + print NSRC "\n"; + $done = 1; + + for ($i = 0; $i < $cnt+1; $i++) { + print NSRC "void create_app1_part$i (void);\n"; + } + + print NSRC "\n"; + + } + print NSRC $dat +} + +print NSRC "{\n"; + +for ($i = 0; $i < $cnt+1; $i++) { + print NSRC " create_app1_part$i ();\n"; +} + +print NSRC $line; + +while ($line = ) { + print NSRC $line; +} + + +close(SRC); +close(EXT); +close(NSRC); + +$cnt++; +$t = "interface.c"; + +for ($i = 0; $i < $cnt; $i++) { + $t .= " interface$i.c"; +} + +`sed -i 's/interface.c/$t/' Makefile.in`; + +$t = 'interface.$(OBJEXT)'; + +for ($i = 0; $i < $cnt; $i++) { + $t .= " interface$i.".'$(OBJEXT)'; +} + +`sed -i 's/interface.\$\(OBJEXT\)/$t/' Makefile.in`; +`mv -f interface_new.c interface.c`; -- cgit v1.2.3-65-gdbad