| 1 | #!/usr/bin/perl |
|---|
| 2 | |
|---|
| 3 | use strict; |
|---|
| 4 | |
|---|
| 5 | use ExtUtils::MakeMaker; |
|---|
| 6 | use File::Basename qw(basename dirname); |
|---|
| 7 | require ExtUtils::MM_Any; |
|---|
| 8 | our @ISA = qw(ExtUtils::MM_Any); |
|---|
| 9 | |
|---|
| 10 | WriteMakefile(NAME => 'gestalt', |
|---|
| 11 | DISTNAME => 'gestalt', |
|---|
| 12 | EXE_FILES => ['bin/gestalt'], |
|---|
| 13 | # Need copious amounts of escaping for this to work. It looks rubbish. |
|---|
| 14 | PM_FILTER => 'sed -e "s/\\@PREFIX\\@/`echo "$(PERLPREFIX)" | sed -e "s/\//\\\\\\\\\\\\\\\\\//g"`/g"', |
|---|
| 15 | # Not sure what the min versions are. Will need to do testing on older versions |
|---|
| 16 | # to find this out. |
|---|
| 17 | PREREQ_PM => {'DBI' => 0, |
|---|
| 18 | 'Apache::DBI' => 0, |
|---|
| 19 | 'Apache::Session' => 0, |
|---|
| 20 | 'Template' => 0, |
|---|
| 21 | 'AppConfig' => 0, |
|---|
| 22 | 'Template::Plugin::Page' => 0 |
|---|
| 23 | }, |
|---|
| 24 | DIR => [ |
|---|
| 25 | 'DB', |
|---|
| 26 | 'Dispatcher', |
|---|
| 27 | 'Controller' ], |
|---|
| 28 | VERSION => '0.2.3'); |
|---|
| 29 | package MY; |
|---|
| 30 | |
|---|
| 31 | use vars qw($VERSION @ISA |
|---|
| 32 | $Is_OS2 $Is_VMS $Is_Win32 $Is_Dos |
|---|
| 33 | $Is_OSF $Is_IRIX $Is_NetBSD $Is_BSD |
|---|
| 34 | $Is_SunOS4 $Is_Solaris $Is_SunOS $Is_Interix |
|---|
| 35 | $Verbose %pm |
|---|
| 36 | %Config_Override |
|---|
| 37 | ); |
|---|
| 38 | |
|---|
| 39 | use ExtUtils::MakeMaker qw($Verbose neatvalue); |
|---|
| 40 | |
|---|
| 41 | BEGIN { |
|---|
| 42 | $Is_OS2 = $^O eq 'os2'; |
|---|
| 43 | $Is_Win32 = $^O eq 'MSWin32'; |
|---|
| 44 | $Is_Dos = $^O eq 'dos'; |
|---|
| 45 | $Is_VMS = $^O eq 'VMS'; |
|---|
| 46 | $Is_OSF = $^O eq 'dec_osf'; |
|---|
| 47 | $Is_IRIX = $^O eq 'irix'; |
|---|
| 48 | $Is_NetBSD = $^O eq 'netbsd'; |
|---|
| 49 | $Is_Interix = $^O eq 'interix'; |
|---|
| 50 | $Is_SunOS4 = $^O eq 'sunos'; |
|---|
| 51 | $Is_Solaris = $^O eq 'solaris'; |
|---|
| 52 | $Is_SunOS = $Is_SunOS4 || $Is_Solaris; |
|---|
| 53 | $Is_BSD = $^O =~ /^(?:free|net|open)bsd$/ or |
|---|
| 54 | $^O eq 'bsdos' or $^O eq 'interix'; |
|---|
| 55 | } |
|---|
| 56 | |
|---|
| 57 | BEGIN { |
|---|
| 58 | if( $Is_VMS ) { |
|---|
| 59 | # For things like vmsify() |
|---|
| 60 | require VMS::Filespec; |
|---|
| 61 | VMS::Filespec->import; |
|---|
| 62 | } |
|---|
| 63 | } |
|---|
| 64 | |
|---|
| 65 | use File::Basename qw(basename dirname); |
|---|
| 66 | require ExtUtils::MM_Any; |
|---|
| 67 | our @ISA = qw(ExtUtils::MM_Any); |
|---|
| 68 | |
|---|
| 69 | sub postamble |
|---|
| 70 | { |
|---|
| 71 | ' |
|---|
| 72 | install :: |
|---|
| 73 | INSTALLCMD="install" ; \ |
|---|
| 74 | if [ -x "/usr/ucb/install" ] ; \ |
|---|
| 75 | then \ |
|---|
| 76 | INSTALLCMD="/usr/ucb/install" ; \ |
|---|
| 77 | fi ; \ |
|---|
| 78 | echo "Using $$INSTALLCMD" ; \ |
|---|
| 79 | $$INSTALLCMD -d -m 0755 $(DESTDIR)$(PERLPREFIX)/share/gestalt ; \ |
|---|
| 80 | $$INSTALLCMD -d -m 0755 $(DESTDIR)$(PERLPREFIX)/share/gestalt/html/js ; \ |
|---|
| 81 | $$INSTALLCMD -d -m 0755 $(DESTDIR)$(PERLPREFIX)/share/gestalt/html/css ; \ |
|---|
| 82 | $$INSTALLCMD -d -m 0755 $(DESTDIR)$(PERLPREFIX)/share/gestalt/templates ; \ |
|---|
| 83 | for file in AUTHORS ChangeLog Controller.pm Makefile.PL Makefile.am \ |
|---|
| 84 | NEWS README Row.pm Table.pm apache.conf.in appConfig.cfg.in appSpec.in \ |
|---|
| 85 | appStartup.pl.in bootstrap configure.in; \ |
|---|
| 86 | do \ |
|---|
| 87 | $$INSTALLCMD -m 0644 templates/$$file $(DESTDIR)$(PERLPREFIX)/share/gestalt/ ; \ |
|---|
| 88 | done ; \ |
|---|
| 89 | $$INSTALLCMD -m 0644 templates/html/Makefile.am $(DESTDIR)$(PERLPREFIX)/share/gestalt/html ; \ |
|---|
| 90 | for file in Makefile.am prototype.js validate.js; \ |
|---|
| 91 | do \ |
|---|
| 92 | $$INSTALLCMD -m 0644 templates/html/js/$$file $(DESTDIR)$(PERLPREFIX)/share/gestalt/html/js ; \ |
|---|
| 93 | done ; \ |
|---|
| 94 | for file in Makefile.am style.css; \ |
|---|
| 95 | do \ |
|---|
| 96 | $$INSTALLCMD -m 0644 templates/html/css/$$file $(DESTDIR)$(PERLPREFIX)/share/gestalt/html/css ; \ |
|---|
| 97 | done ; \ |
|---|
| 98 | for file in _fieldDisplay.tt2 _fieldInput.tt2 _fkeyDisplay.tt2 _fkeyInput.tt2 \ |
|---|
| 99 | _form.tt2 _header.tt2 _pager.tt2 create.tt2 edit.tt2 list.tt2 show.tt2 _auth.tt2 ; \ |
|---|
| 100 | do \ |
|---|
| 101 | $$INSTALLCMD -m 0644 templates/templates/$$file $(DESTDIR)$(PERLPREFIX)/share/gestalt/templates ; \ |
|---|
| 102 | done |
|---|
| 103 | |
|---|
| 104 | rpm: dist |
|---|
| 105 | cp $(NAME)-$(VERSION).tar.gz /usr/src/redhat/SOURCES/ |
|---|
| 106 | rpmbuild -ba $(NAME).spec |
|---|
| 107 | cp /usr/src/redhat/SRPMS/$(NAME)-$(VERSION)-1.src.rpm . |
|---|
| 108 | cp /usr/src/redhat/RPMS/noarch/$(NAME)-$(VERSION)-1.noarch.rpm . |
|---|
| 109 | |
|---|
| 110 | '; |
|---|
| 111 | } |
|---|
| 112 | |
|---|
| 113 | sub installbin { |
|---|
| 114 | my($self) = shift; |
|---|
| 115 | |
|---|
| 116 | return "" unless $self->{EXE_FILES} && ref $self->{EXE_FILES} eq "ARRAY"; |
|---|
| 117 | my @exefiles = @{$self->{EXE_FILES}}; |
|---|
| 118 | return "" unless @exefiles; |
|---|
| 119 | |
|---|
| 120 | @exefiles = map vmsify($_), @exefiles if $Is_VMS; |
|---|
| 121 | |
|---|
| 122 | my %fromto; |
|---|
| 123 | for my $from (@exefiles) { |
|---|
| 124 | my($path)= $self->catfile('$(INST_SCRIPT)', basename($from)); |
|---|
| 125 | |
|---|
| 126 | local($_) = $path; # for backwards compatibility |
|---|
| 127 | my $to = $self->libscan($path); |
|---|
| 128 | print "libscan($from) => '$to'\n" if ($Verbose >=2); |
|---|
| 129 | |
|---|
| 130 | $to = vmsify($to) if $Is_VMS; |
|---|
| 131 | $fromto{$from} = $to; |
|---|
| 132 | } |
|---|
| 133 | my @to = values %fromto; |
|---|
| 134 | |
|---|
| 135 | my @m; |
|---|
| 136 | push(@m, qq{ |
|---|
| 137 | EXE_FILES = @exefiles |
|---|
| 138 | |
|---|
| 139 | pure_all :: @to |
|---|
| 140 | \$(NOECHO) \$(NOOP) |
|---|
| 141 | |
|---|
| 142 | realclean :: |
|---|
| 143 | \$(INST_SCRIPT)/.exists :: \$(PERL_INC)/perl.h |
|---|
| 144 | \$(NOECHO) \$(MKPATH) \$(INST_SCRIPT) |
|---|
| 145 | \$(NOECHO) \$(EQUALIZE_TIMESTAMP) \$(PERL_INC)/perl.h \$(INST_SCRIPT)/.exists |
|---|
| 146 | |
|---|
| 147 | -\$(NOECHO) \$(CHMOD) \$(PERM_RWX) \$(INST_SCRIPT) |
|---|
| 148 | |
|---|
| 149 | \$(INST_BIN)/.exists :: \$(PERL_INC)/perl.h |
|---|
| 150 | \$(NOECHO) \$(MKPATH) \$(INST_BIN) |
|---|
| 151 | \$(NOECHO) \$(EQUALIZE_TIMESTAMP) \$(PERL_INC)/perl.h \$(INST_BIN)/.exists |
|---|
| 152 | |
|---|
| 153 | -\$(NOECHO) \$(CHMOD) \$(PERM_RWX) \$(INST_BIN) |
|---|
| 154 | |
|---|
| 155 | }); |
|---|
| 156 | |
|---|
| 157 | # # realclean can get rather large. |
|---|
| 158 | # push @m, map "\t$_\n", $self->split_command('$(RM_F)', @to); |
|---|
| 159 | # push @m, "\t" . '$(RM_F)' . join(' ', @to); |
|---|
| 160 | |
|---|
| 161 | if ($self->can('split_command')) |
|---|
| 162 | { |
|---|
| 163 | push @m, map "\t$_\n", $self->split_command('$(RM_F)', @to); |
|---|
| 164 | } |
|---|
| 165 | else |
|---|
| 166 | { |
|---|
| 167 | push @m, "\t" . '$(RM_F) ' . join(' ', @to); |
|---|
| 168 | } |
|---|
| 169 | push @m, "\n"; |
|---|
| 170 | |
|---|
| 171 | |
|---|
| 172 | # A target for each exe file. |
|---|
| 173 | while (my($from,$to) = each %fromto) { |
|---|
| 174 | last unless defined $from; |
|---|
| 175 | |
|---|
| 176 | push @m, sprintf <<'MAKE', $to, $from, $to, $from, $to, $to, $to; |
|---|
| 177 | %s : %s $(FIRST_MAKEFILE) $(INST_SCRIPT)/.exists $(INST_BIN)/.exists |
|---|
| 178 | $(NOECHO) $(RM_F) %s |
|---|
| 179 | $(PM_FILTER) < %s > %s |
|---|
| 180 | -$(NOECHO) $(CHMOD) $(PERM_RWX) %s |
|---|
| 181 | |
|---|
| 182 | MAKE |
|---|
| 183 | |
|---|
| 184 | } |
|---|
| 185 | |
|---|
| 186 | join "", @m; |
|---|
| 187 | } |
|---|
| 188 | |
|---|