Alien-TinyCC

 view release on metacpan or  search on metacpan

inc/My/Build.pm  view on Meta::CPAN


use strict;
use warnings;
use parent 'Module::Build';

sub ACTION_build {
	my $self = shift;
	
	mkdir 'share';
	
	$self->SUPER::ACTION_build;
}

use File::Path;
sub ACTION_clean {
	my $self = shift;
	
	File::Path::remove_tree('share');
	$self->notes('build_state', '');
	
	# Call system-specific cleanup code
	$self->my_clean;
	
	# Call base class code
	$self->SUPER::ACTION_clean;
}

use File::Copy;
use File::Spec;
sub ACTION_devsetup {
	my $self = shift;
	system qw(git submodule init);
	system qw(git submodule update);
	my $hook_filename = File::Spec->catfile(qw<.git hooks pre-commit>);
	copy 'git-pre-commit-hook.pl' => $hook_filename;

inc/My/Build.pm  view on Meta::CPAN

	my $self = shift;
	reset_src;
	$self->ACTION_realclean;
}

# This one's an author action, so I assume they have git and have properly
# configured.
sub ACTION_dist {
	my $self = shift;
	reset_src;
	$self->SUPER::ACTION_dist;
}

# This one's an author action, so I assume they have git and have properly
# configured.
sub ACTION_distdir {
	my $self = shift;
	reset_src;
	$self->SUPER::ACTION_distdir;
}

# This one's an author action, so I assume they have git and have properly
# configured.
sub ACTION_disttest {
	my $self = shift;
	reset_src;
	$self->SUPER::ACTION_disttest;
}

sub apply_patches {
	my ($filename, @patches) = @_;
	
	# make the file read-write (and executable, but that doesn't matter)
	chmod 0700, $filename;
	
	open my $in_fh, '<', $filename
		or die "Unable to open $filename for patching!";

inc/My/Build/Linux.pm  view on Meta::CPAN


use Cwd;
sub ACTION_code {
	my $self = shift;
	$self->notes('build_state', '') unless defined $self->notes('build_state');
	
	# Build an absolute prefix to our (local) sharedir, build and install
	my $prefix = File::Spec->catdir(getcwd(), 'share');
	$self->install_to_prefix($prefix);
	
	$self->SUPER::ACTION_code;
}

sub my_clean {
	my $self = shift;
	return unless -f 'src/config.mak';
	
	# Get the system-specific make command
	my $make = $self->make_command;
	
	chdir 'src';

inc/My/Build/Linux.pm  view on Meta::CPAN

	# Instead, I copy code from Alien::Base::ModuleBuild to calculate the
	# sharedir location by-hand:
	my $prefix = File::Spec->catdir($self->install_destination('lib'),
		qw(auto share dist Alien-TinyCC));
	
	# Completely rebuild (and install) the compiler with the new prefix
	File::Path::make_path($prefix);
	$self->install_to_prefix($prefix);
	
	# Proceed with the rest of the install
	$self->SUPER::ACTION_install;
}

### ucontext location detection patch ###

use File::Temp qw/ tempfile /;
use Config;

# Header file test
sub try_include_file {
	my $lib_name = shift;

inc/My/Build/MacOSX.pm  view on Meta::CPAN

                    print "Scrubbing -march=native from $varname\n";
                }
                if ($ENV{$varname} =~ s/-fassociative-math//) {
                    print "Scrubbing -fassociative-math from $varname\n";
                }
            }
        }
    }
    
    # Continue with the rest of the install to prefix
    $self->SUPER::install_to_prefix($prefix);
}

1;

inc/My/Build/Windows.pm  view on Meta::CPAN

		# check if there was a mishap:
		$ENV{ERRORLEVEL} and die 'build-tcc.bat failed';
		
		# Copy the files to the distribution's share dir
		File::Copy::Recursive::rcopy_glob('src\\win32\\*' => 'share\\');
		
		# Note that we've built it.
		$self->notes('build_state', 'built');
	}
	
	$self->SUPER::ACTION_code;
}

sub my_clean {}

# Figure out if this is a 64-bit system:
use Config;
my $is_64_bit = ($Config{archname} =~ /^MSWin32-(.*?)-/ and $1 eq 'x64');

# Patch the build batch file
My::Build::apply_patches('src\\win32\\build-tcc.bat',



( run in 1.210 second using v1.01-cache-2.11-cpan-49f99fa48dc )