Package: apt-build Version: 0.12.4 Severity: normal
I'm sorry but this patch do not only fix bugs but also provide new features required for dpkg-cross support.
About the bug fix. The "old" source() function was not used the right way in all situation. I've introduced two function which provide the right interface: + source_by_source(): first parameter is source name + source_by_package(): first parameter is the package name Architecture is determined by $_config->get("APT::Architecture") instead of using dpkg --print-architecture. This is mandatory for dpkg-cross.
About the cleanups. I've simplified the parse_conf() function. The cc.wrapper.c and make.wrapper.c implementation are merged to wrapper.c which works in the same way. Which parameters are considered is implemented in parse_conf(). I've also moved the installation to Makefile by introducing a install target which supports the DESTDIR variable.
About the extensions. It's not possible to overwrite the default apt-build configuration file /etc/apt/apt-build.conf with its own. For this the --config options was added. The wrapper.c implementation uses a new function filterout_libdir_path() part of config.c which remove the /usr/lib/apt-build part from PATH. This allow the usage of ccache or the dpkg-cross's GCC wrapper implementation out-of-the-box. It's also possible to overwrite the apt-get and apt-cache application which is required in case of dpkg-cross. For dpkg-cross apt-get-cross and apt-cache-cross have to be used. Additional two command line options --apt-get and --apt-cache allow to override this too.
For any further explenation please contact me so it become possible to make dpkg-cross support part of apt-build as soon as possible. Thx for this great tool!
-- Raphael Bossek
diff -wNru apt-build-0.12.4/apt-build apt-build-0.12.4.1/apt-build --- apt-build-0.12.4/apt-build 2005-05-13 21:02:23.000000000 +0200 +++ apt-build-0.12.4.1/apt-build 2005-05-19 09:28:04.476947448 +0200 @@ -125,8 +125,11 @@ --repository-dir - Specify the repository directory --target-release - Distribution to fetch packages from --sources-list - Specify sources.list file + --apt-get - Specify an alternative apt-get application to use + --apt-cache - Specify an alternative apt-cache application to use + --config - Specify an alternative configuration file "; -exit 1 + exit 1; } # Since shell returns 0 on success, and our script usually uses true values @@ -147,13 +150,13 @@ sub remove { print STDERR "-----> Removing packages (@_) <-----"; - !system "apt-get @apt_args remove @_" + !system $conf->apt_get . " @apt_args remove @_" } sub update { print STDERR "-----> Updating package lists <-----"; - !system "apt-get @apt_args update" + !system $conf->apt_get . " @apt_args update" } sub move_to_repository @@ -173,7 +176,8 @@ { my @seen; # Skip multiple entries for the same pkg version my @list = $_source->find($pkg); - for (@list) { + for (@list) + { my $ver = $$_{Version}; grep {/$ver/} @seen and next; # Skip if seen push @seen, $ver; @@ -195,7 +199,7 @@ print ''; } return @res if defined wantarray; - 1 + return 1; } @@ -203,18 +207,19 @@ { my @size; - for (@_) { + for (@_) + { my $pkg = $_; # (full explanation for read_apt_list is below) # We invoke apt-get here to determine package size push @size, - read_apt_list("apt-get --print-uris @apt_args source $pkg |", + read_apt_list($conf->apt_get . " --print-uris @apt_args source $pkg |", "^'", \&extract_size); # and to determine package dependencies, and their cumulative size my (@size_deps, @deps); - read_apt_list("apt-get --print-uris @apt_args build-dep $pkg |", + read_apt_list($conf->apt_get . " --print-uris @apt_args build-dep $pkg |", "^'", sub { push @size_deps, extract_size($_); push @deps, extract_name($_); @@ -233,24 +238,33 @@ return 1; } -sub source +sub source_by_package { - my $pkg_name = shift or return; + my $pkg_name = shift or die "Missing package name for source_by_package().\n"; my ($pkg_version, $src_version, $src_name); if (!($src_version = shift)) { # no version passed along. - $pkg_version = &get_pkg_version($pkg_name); - $src_version = &get_src_version($pkg_name, $pkg_version); + $src_version = &get_src_version($pkg_name); } $src_name = &get_src_name($pkg_name, $src_version); + print STDERR "D(240): pkg_name=$pkg_name src_name=$src_name src_version=$src_version\n"; + + return source_by_source ($src_name, $src_version); +} + +sub source_by_source +{ + my $src_name = $_[0] or die "Missing source pakcage name for source_by_source().\n"; + my $src_version = $_[1] or die "Missing version information for source package $src_name in source_by_source().\n"; + update() if $conf->update; # to be consistent with install() - print STDERR "-----> Downloading $pkg_name source ($src_name $src_version) <-----"; - return !system "apt-get @apt_args source ${src_name}=${src_version}"; + print STDERR "-----> Downloading source $src_name ($src_version) <-----"; + return !system $conf->apt_get . " @apt_args source ${src_name}=${src_version}" } sub build @@ -356,12 +370,12 @@ if ($conf->remove_builddep) { - read_apt_list("apt-get --print-uris @apt_args build-dep $pkg |", + read_apt_list($conf->apt_get . " --print-uris @apt_args build-dep $pkg |", "^'", \&extract_name); } print STDERR "-----> Installing build dependencies (for $pkg) <-----"; - !system "apt-get @apt_args build-dep $pkg" + !system $conf->apt_get . " @apt_args build-dep $pkg" } @@ -379,16 +393,17 @@ sub get_src_version { - my ($pkg_name, $pkg_version) = @_; + my $pkg_name = $_[0] || die; + my $pkg_version = $_[1] || &get_pkg_version($pkg_name); my ($src_version, $special_srcver); # By default $src_version = $pkg_version; - open APTCIN, "apt-cache show $pkg_name |"; + open APTCIN, $conf->apt_cache . " show $pkg_name |"; while(<APTCIN>) { - $special_srcver = 1 if(/^Version: $pkg_version$/); - if ($special_srcver && /^Source: $pkg_name \((.*)\)/) + $special_srcver = 1 if($pkg_version and /^Version: $pkg_version$/); + if (/^Version: (\S+)$/ and ($special_srcver or not $pkg_version)) { $src_version = $1; last; @@ -405,7 +420,7 @@ my $pkg_version; # Look for candidate version - open APTCIN, "apt-cache policy $pkg_name |"; + open APTCIN, $conf->apt_cache . " policy $pkg_name |"; while(<APTCIN>) { $pkg_version = $1 if(/^\s+Candidate: (.*)$/); } close(APTCIN); @@ -468,7 +483,7 @@ push @pkgs, $deb_file; builddep($src_name) unless $conf->build_only; - source($src_name, $src_version) if $conf->source; + source_by_package($pkg_name, $src_version) if $conf->source; # Now build the package my $upver = $_version->upstream($src_version); @@ -499,38 +514,40 @@ if(@pkgs && !($conf->build_only)) { update() if $conf->update; - system("apt-get -t apt-build @apt_args install @pkglist"); + system($conf->apt_get . " -t apt-build @apt_args install @pkglist"); wait; } - 1 + return 1; } sub build_source { - my (@packages, @pkgs, $buildpkg); + my (@packages, @pkgs, $src_name); my (@pkglist) = @_; my $nopkgs_okay = 0; for (@_) { my $pkg = $_; - open APTIN, "apt-get --print-uris @apt_args source $pkg |"; #2>&1 | + open APTIN, $conf->apt_get . " --print-uris @apt_args source $pkg |"; #2>&1 | AI: while (<APTIN>) { - if ( /^Package .* is a virtual package provided by/ ) { - system("apt-get @apt_args install $pkg"); + if ( /^Package .* is a virtual package provided by/ ) + { + system($conf->apt_get . " @apt_args install $pkg"); exit 0; } elsif ( /^\'(http|ftp|file|cdrom)/ ) { @packages = split /\s+/; $packages[1] =~ /^(.*)_(.*)\.dsc$/ or last; # XXX - my ($buildpkg, $version) = ($1, $2); - my $arch=qx[dpkg --print-architecture]; chomp $arch; + my ($src_name, $src_version) = ($1, $2); + my $arch=$_config->get("APT::Architecture"); - my $apcout = qx[apt-cache showsrc $pkg | grep "^Binary:" | head -1]; + my $aptcache = $conf->apt_cache; + my $apcout = qx[$aptcache showsrc $pkg | grep "^Binary:" | head -1]; chomp $apcout; - my $fullversion = qx[apt-cache showsrc $buildpkg | grep "^Version:" | head -1]; + my $fullversion = qx[$aptcache showsrc $src_name | grep "^Version:" | head -1]; chomp $fullversion; $fullversion =~ s/Version: //; my $build = 1; @@ -541,18 +558,17 @@ # so not everything is built foreach my $gpkg (@genpackages) { - print $gpkg; - - if ((( -f "$conf{repository_dir}/${gpkg}_${version}_${arch}.deb") || - ( -f "$conf{repository_dir}/${gpkg}_${version}_all.deb" )) - && !($conf->rebuild) ) { - print "Package $buildpkg already in repository."; + if ((( -f "$conf{repository_dir}/${gpkg}_${src_version}_${arch}.deb") || + ( -f "$conf{repository_dir}/${gpkg}_${src_version}_all.deb" )) + && !($conf->rebuild) ) + { + print "Package $src_name already in repository."; $nopkgs_okay++; $build = 0; } - # if (!( -f "$conf{repository_dir}/${gpkg}_${version}_${arch}.deb") && - # !( -f "$conf{repository_dir}/${gpkg}_${version}_all.deb" )) { - # print "Package $buildpkg missing in repository."; + # if (!( -f "$conf{repository_dir}/${gpkg}_${src_version}_${arch}.deb") && + # !( -f "$conf{repository_dir}/${gpkg}_${src_version}_all.deb" )) { + # print "Package $src_name missing in repository."; # print "Trying to rebuild."; # $missing = 1; # } @@ -561,8 +577,8 @@ wait; #if ($missing) { $build=1; }; if ($build) { - builddep($buildpkg) unless $conf->build_only; - source($buildpkg) if $conf->source; + builddep($src_name) unless $conf->build_only; + source_by_source ($src_name, $src_version) if $conf->source; patch($_) for @{$conf->patch}; # Now build the package @@ -574,7 +590,7 @@ } $upver =~ s/%3a/:/; - if (build($buildpkg, $upver, $maintver)) { + if (build($src_name, $upver, $maintver)) { &move_to_repository; &build_repository; $nopkgs_okay++; @@ -601,7 +617,7 @@ if( @pkgs && !($conf->build_only) ) { update() if $conf->update; - system("apt-get -t apt-build @apt_args install @pkglist"); + system($conf->apt_get . " -t apt-build @apt_args install @pkglist"); } } @@ -619,7 +635,8 @@ my $pkg=$_; $pkg =~ /^(.*)_(.*)\.dsc/ or warn; my ($buildpkg, $version) = ($1, $2); - my $newversion = qx[apt-cache showsrc $buildpkg | grep "^Version:" | head -1]; chomp $newversion; + my $apt_cache = $conf->apt_cache; + my $newversion = qx[$apt_cache showsrc $buildpkg | grep "^Version:" | head -1]; chomp $newversion; $newversion =~ s/Version: //; $newversion =~ s/[0-9]://; if ($newversion ne $version) @@ -654,7 +671,8 @@ $version =~ s/-[0-9]$//; print "${buildpkg}-${version}"; - if (-d "${buildpkg}-${version}") { + if (-d "${buildpkg}-${version}") + { chdir "${buildpkg}-${version}"; print STDERR "----> Cleaning up object files <-----"; print STDERR "Package $buildpkg"; @@ -662,7 +680,6 @@ chdir $conf->build_dir; } } - } sub world @@ -687,7 +704,7 @@ { print STDERR "-----> Upgrading (@_) <-----"; @_ or @_ = read_apt_list( - "apt-get --print-uris @apt_args upgrade |", "^'", \&extract_name); + $conf->apt_get . " --print-uris @apt_args upgrade |", "^'", \&extract_name); @_ ? install(@_) : print STDERR "No packages need to be upgraded"; return 1; @@ -730,7 +747,13 @@ } }, # ALIAS =>, so imperfect and universe-breaking, and we still need it. - "config|cfg=s", { DEFAULT => "/etc/apt/apt-build.conf" }, + "config|cfg=s", { DEFAULT => "/etc/apt/apt-build.conf", + ALIAS => "config", + ACTION => sub + { + $conf->file ($_[2]) if -r $_[2]; + }, + }, "remove_builddep!", { ALIAS => "remove-builddep" }, "wrapper!", { DEFAULT => 0 }, "purge!", { ACTION => \&apt_args_modify }, @@ -758,6 +781,10 @@ ALIAS => "sources-list" }, "update!", { DEFAULT => 1 }, "cleanup!", { DEFAULT => 1 }, # call debian/rules clean after build + "apt_get|aptget=s", { DEFAULT => "apt-get", + ALIAS => "apt-get" }, + "apt_cache|aptcache=s", { DEFAULT => "apt-cache", + ALIAS => "apt-cache" }, "Olevel=s", {}, "mcpu=s", {}, "options=s", {}, @@ -769,12 +796,11 @@ tie %conf, 'AptBuild::ObjHash', \$conf; # see AptBuild::ObjHash below - $conf->file($conf->cfg) if -r $conf->cfg; # read the config file $conf->getopt; # parse command line $APT_BUILD_WRAPPER++ unless $conf->wrapper; # define ENV var unshift @PATH, "/usr/lib/apt-build/" unless $conf->wrapper; - 1 + return 1; } diff -wNru apt-build-0.12.4/apt-build.h apt-build-0.12.4.1/apt-build.h --- apt-build-0.12.4/apt-build.h 2005-04-26 17:27:44.000000000 +0200 +++ apt-build-0.12.4.1/apt-build.h 2005-05-13 11:45:53.000000000 +0200 @@ -1,9 +1,7 @@ #define APT_BUILD_CONF_PATH "/etc/apt/apt-build.conf" #define APT_BUILD_STRING_ENV "APT_BUILD_WRAPPER" -#define GPP_PATH "/usr/bin/g++" -#define GCC_PATH "/usr/bin/gcc" -#define MAKE_PATH "/usr/bin/make" +#define LIBDIR "/usr/lib/apt-build/" #define MAKE_ARGC 0 #define GCC_ARGC 2 diff -wNru apt-build-0.12.4/cc.wrapper.c apt-build-0.12.4.1/cc.wrapper.c --- apt-build-0.12.4/cc.wrapper.c 2005-04-26 17:33:39.000000000 +0200 +++ apt-build-0.12.4.1/cc.wrapper.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,54 +0,0 @@ -/* - * $Id: cc.wrapper.c 603 2005-04-26 15:33:36Z acid $ - * gcc.wrapper - Wrapper for gcc used for apt-build - * (c) 2004 - Julien Danjou <[EMAIL PROTECTED]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2, as - * published by the Free Software Foundation. - * - */ - - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> - -#include "apt-build.h" -#include "config.h" - -int -gcc_real (char **argv) -{ - char *s; - - s = strdup (basename (argv[0])); - - /* Compare the end */ - s += strlen (basename (argv[0])) - 2; - - if (!strncmp (s, "cc", 2)) - return execv (GCC_PATH, argv); - - if (!strncmp (s, "++", 2)) - return execv (GPP_PATH, argv); - - fprintf (stderr, "Unable to guess the compiler you want\n"); - return -1; -} - -int -gcc_apt_build (int argc, char **argv) -{ - return gcc_real (parse_conf (argc, argv)); -} - -int -main (int argc, char **argv) -{ - if (getenv (APT_BUILD_STRING_ENV)) - return gcc_apt_build (argc, argv); - - return gcc_real (argv); -} diff -wNru apt-build-0.12.4/config.c apt-build-0.12.4.1/config.c --- apt-build-0.12.4/config.c 2005-05-13 21:04:28.000000000 +0200 +++ apt-build-0.12.4.1/config.c 2005-05-18 12:06:23.000000000 +0200 @@ -53,15 +53,17 @@ { FILE *conf; unsigned int i = 0, nb_apt_build_options = 0; + int is_gcc = 0; char *file_content; char buf[BUF_SIZE]; char opt[BUF_SIZE]; char *str; char **cmd_line_args; struct apt_build_args args; + char *options = NULL; - args.options = NULL; - args.make_options = NULL; + /* Reset the configuration */ + memset (&args, 0, sizeof (args)); conf = fopen (APT_BUILD_CONF_PATH, "r"); @@ -96,77 +98,82 @@ fclose (conf); free (file_content); + /* Build the new command line */ + cmd_line_args = + (char **) malloc (sizeof (char *) * (argc + (MAKE_ARGC > GCC_ARGC ? MAKE_ARGC : GCC_ARGC) + 1)); + + cmd_line_args[nb_apt_build_options++] = strdup (argv[0]); + /* make options */ if(!strcmp(basename(argv[0]), "make")) { - cmd_line_args = (char **) malloc(sizeof(char *) * (argc + MAKE_ARGC + 1)); + options = args.make_options; + } + else + { + options = args.options; + is_gcc = 1; + } - if(args.make_options && - strlen(args.make_options) && - (str = strtok(args.make_options, " "))) + /* Apply options as specified by the configuration file. */ + if (options && + strlen (options) && + (str = strtok (options, " "))) { - i = 0; do { - i++; cmd_line_args = (char **) - realloc(cmd_line_args, sizeof(char *) * (argc + MAKE_ARGC + 1 + i)); - cmd_line_args[MAKE_ARGC + i] = strdup(str); + realloc (cmd_line_args, + sizeof (char *) * (argc + nb_apt_build_options + 1)); + cmd_line_args[nb_apt_build_options++] = strdup (str); } while((str = strtok(NULL, " "))); - nb_apt_build_options = i; } - /* Build the command line */ - cmd_line_args[0] = argv[0]; - /* Copy the rest of the line */ for(i = 1; i < argc; i++) - cmd_line_args[MAKE_ARGC + nb_apt_build_options + i] = argv[i]; + cmd_line_args[nb_apt_build_options++] = strdup (argv[i]); - cmd_line_args[argc + nb_apt_build_options + MAKE_ARGC] = NULL; - -#ifdef DEBUG - for(i = 0; i < argc + nb_apt_build_options + MAKE_ARGC; i++) - printf("argv[%d] -> %s\n", i, cmd_line_args[i]); -#endif - } - else + /* Apply GCC options at the end to override the default options. */ + if (is_gcc) { + if (args.Olevel) + cmd_line_args[nb_apt_build_options++] = args.Olevel; + if (args.mcpu) + cmd_line_args[nb_apt_build_options++] = args.mcpu; - cmd_line_args = - (char **) malloc (sizeof (char *) * (argc + GCC_ARGC + 1)); - - if (args.options && - strlen (args.options) && - (str = strtok (args.options, " "))) - { - i = argc + GCC_ARGC; - do - { - cmd_line_args[i++] = strdup(str); - cmd_line_args = (char **) - realloc(cmd_line_args, sizeof(char *) * (i + 1)); - } - while ((str = strtok (NULL, " "))); - cmd_line_args[i] = NULL; } - /* Build the command line */ - cmd_line_args[0] = argv[0]; - - /* Copy the rest of the line */ - for (i = 1; i < argc; i++) - cmd_line_args[i] = argv[i]; + cmd_line_args[nb_apt_build_options++] = NULL; - cmd_line_args[i++] = args.Olevel; - cmd_line_args[i] = args.mcpu; - -#ifdef DEBUG - for(i = 0; cmd_line_args[i] != NULL; i++) - printf("argv[%d] -> %s\n", i, cmd_line_args[i]); +#if 0 + for(i = 0; i < nb_apt_build_options; i++) */ + printf("argv[%d] -> %s\n", i, cmd_line_args[i]); */ #endif - } return cmd_line_args; } + +void +filterout_libdir_path (void) +{ + char *path; + char *newpath; + char *libdir; + int len; + + /* Filter out standard apt-build search directory. */ + path = getenv ("PATH"); + if (path) + { + libdir = strstr (path, LIBDIR); + if (libdir) + { + len = strlen (LIBDIR); + memmove (libdir, libdir + len, strlen (path) - len - (libdir - path) + 1); + asprintf (&newpath, "PATH=%s", path); + putenv (newpath); + free (newpath); + } + } +} diff -wNru apt-build-0.12.4/config.h apt-build-0.12.4.1/config.h --- apt-build-0.12.4/config.h 2005-04-26 17:27:44.000000000 +0200 +++ apt-build-0.12.4.1/config.h 2005-05-13 11:46:31.000000000 +0200 @@ -1,2 +1,3 @@ char *parse_options (char *file_content); char **parse_conf (unsigned int argc, char **argv); +void filterout_libdir_path (void); diff -wNru apt-build-0.12.4/debian/changelog apt-build-0.12.4.1/debian/changelog --- apt-build-0.12.4/debian/changelog 2005-05-13 20:36:05.000000000 +0200 +++ apt-build-0.12.4.1/debian/changelog 2005-05-18 11:27:25.000000000 +0200 @@ -1,3 +1,11 @@ +apt-build (0.12.4.1) experimental; urgency=low + + * Flexible configuration possibilities via command line. + * Uses APT configuration to determine architecture. + * Fixed problems with package installation. + + -- Raphael Bossek <[EMAIL PROTECTED]> Mon, 9 May 2005 09:26:14 +0200 + apt-build (0.12.4) experimental; urgency=low * Add vi translation diff -wNru apt-build-0.12.4/debian/rules apt-build-0.12.4.1/debian/rules --- apt-build-0.12.4/debian/rules 2005-04-24 19:37:30.000000000 +0200 +++ apt-build-0.12.4.1/debian/rules 2005-05-18 11:28:30.000000000 +0200 @@ -52,25 +52,13 @@ dh_clean -k dh_installdirs + $(MAKE) DESTDIR=debian/apt-build HOST_TYPE=$(DEB_HOST_GNU_TYPE) install + # Add here commands to install the package into debian/apt-build. sed 's/my $$VERSION = .*/my $$VERSION = "$(shell head -n 1 debian/changelog | cut -d " " -f 2 | sed -e 's/(//; s/)//;' | cut -d "-" -f 2)";/' apt-build > debian/apt-build/usr/bin/apt-build - chmod 0755 debian/apt-build/usr/bin/apt-build - install cc.wrapper debian/apt-build/usr/lib/apt-build/ - install make.wrapper debian/apt-build/usr/lib/apt-build/ - # gcc - dh_link usr/lib/apt-build/cc.wrapper usr/lib/apt-build/gcc - dh_link usr/lib/apt-build/cc.wrapper usr/lib/apt-build/cc - dh_link usr/lib/apt-build/cc.wrapper usr/lib/apt-build/$(DEB_HOST_GNU_TYPE)-gcc - # g++ - dh_link usr/lib/apt-build/cc.wrapper usr/lib/apt-build/g++ - dh_link usr/lib/apt-build/cc.wrapper usr/lib/apt-build/c++ - dh_link usr/lib/apt-build/cc.wrapper usr/lib/apt-build/$(DEB_HOST_GNU_TYPE)-g++ - # make - dh_link usr/lib/apt-build/make.wrapper usr/lib/apt-build/make install -m 644 debian/Release debian/apt-build/usr/share/apt-build/ - # Build architecture-independent files here. binary-indep: build install # We have nothing to do by default. diff -wNru apt-build-0.12.4/Makefile apt-build-0.12.4.1/Makefile --- apt-build-0.12.4/Makefile 2005-05-13 20:41:04.000000000 +0200 +++ apt-build-0.12.4.1/Makefile 2005-05-18 11:39:01.000000000 +0200 @@ -1,15 +1,33 @@ -CC_BIN = cc.wrapper -MAKE_BIN = make.wrapper +# $Id$ + +APT_BUILD = apt-build +APT_BUILD_WRAPPER = apt-build-wrapper +WRAP_PROGRAMMS = gcc cc g++ c++ make CFLAGS = -W -Wall -D_GNU_SOURCE -g -OBJ_FILES = config.o +INSTALL = install +LN_S = ln -s +BINDIR = $(DESTDIR)/usr/bin +APT_BUILD_DIR = $(DESTDIR)/usr/lib/apt-build +HOST_TYPE = -all: $(CC_BIN) $(MAKE_BIN) +all: $(APT_BUILD_WRAPPER) -$(CC_BIN): cc.wrapper.c config.o - $(CC) $(CFLAGS) -o $(CC_BIN) cc.wrapper.c config.o +$(APT_BUILD_WRAPPER): wrapper.c config.o + $(CC) $(CFLAGS) -o $@ $^ -$(MAKE_BIN): make.wrapper.c config.o - $(CC) $(CFLAGS) -o $(MAKE_BIN) make.wrapper.c config.o +install: $(APT_BUILD_WRAPPER) $(APT_BUILD) + $(INSTALL) -g 0 -o 0 -d $(BINDIR) + $(INSTALL) -g 0 -o 0 -m 755 $(APT_BUILD) $(BINDIR) + $(INSTALL) -g 0 -o 0 -d $(APT_BUILD_DIR) + $(INSTALL) -g 0 -o 0 -m 755 $(APT_BUILD_WRAPPER) $(APT_BUILD_DIR) + for prog in $(WRAP_PROGRAMMS); do \ + $(LN_S) $(APT_BUILD_WRAPPER) $(APT_BUILD_DIR)/$$prog; \ + done +ifneq ($(HOST_TYPE),) + for prog in gcc g++; do \ + $(LN_S) $(APT_BUILD_WRAPPER) $(APT_BUILD_DIR)/$$prog-$(HOST_TYPE); \ + done +endif clean: - rm -f $(OBJ_FILES) $(CC_BIN) $(MAKE_BIN) + rm -f *.o $(APT_BUILD_WRAPPER) cc.wrapper.c make.wrapper.c diff -wNru apt-build-0.12.4/make.wrapper.c apt-build-0.12.4.1/make.wrapper.c --- apt-build-0.12.4/make.wrapper.c 2005-04-26 17:33:39.000000000 +0200 +++ apt-build-0.12.4.1/make.wrapper.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,38 +0,0 @@ -/* - * $Id: make.wrapper.c 603 2005-04-26 15:33:36Z acid $ - * gcc.wrapper - Wrapper for gcc used for apt-build - * (c) 2004 - Julien Danjou <[EMAIL PROTECTED]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2, as - * published by the Free Software Foundation. - * - */ - - -#include <stdlib.h> -#include <unistd.h> - -#include "apt-build.h" -#include "config.h" - -int -make_real (char **argv) -{ - return execv (MAKE_PATH, argv); -} - -int -make_apt_build (int argc, char **argv) -{ - return make_real (parse_conf (argc, argv)); -} - -int -main (int argc, char **argv) -{ - if (getenv (APT_BUILD_STRING_ENV)) - return make_apt_build (argc, argv); - - return make_real (argv); -} diff -wNru apt-build-0.12.4/wrapper.c apt-build-0.12.4.1/wrapper.c --- apt-build-0.12.4/wrapper.c 1970-01-01 01:00:00.000000000 +0100 +++ apt-build-0.12.4.1/wrapper.c 2005-05-13 19:00:39.000000000 +0200 @@ -0,0 +1,42 @@ +/* + * $Id$ + * wrapper.c - Wrapper for gcc and make used for apt-build + * (c) 2004 - Julien Danjou <[EMAIL PROTECTED]> + * (c) 2005 Raphael Bossek <[EMAIL PROTECTED]> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + */ + + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> + +#include "apt-build.h" +#include "config.h" + +int +gcc_real (char **argv) +{ + filterout_libdir_path(); + return execvp (basename (argv[0]), argv); +} + +int +gcc_apt_build (int argc, char **argv) +{ + return gcc_real (parse_conf (argc, argv)); +} + +int +main (int argc, char **argv) +{ + if (getenv (APT_BUILD_STRING_ENV)) + return gcc_apt_build (argc, argv); + + return gcc_real (argv); +}