forked from liip/packaging
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure
executable file
·66 lines (53 loc) · 1.96 KB
/
configure
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/env php
<?php
require_once(dirname(__FILE__) . '/common.php');
$flags = array(
'depends' => '-d',
'postinst' => '--post-install',
'preinst' => '--pre-install',
'postrm' => '--post-uninstall',
'prerm' => '--pre-uninstall',
);
$configure = get_config('configure');
$filemapping = get_config('filemapping');
print 'Generating makefile... ';
$makefile = get_makefile_in();
$install_cmd = get_install_cmd();
$makefile = replace($makefile, 'INSTALLCMD', $install_cmd);
$makefile = replace($makefile, 'PACKAGINGDIR', basename(dirname(__FILE__)));
$makefile = replace($makefile, 'PACKAGINGPARENTDIR', dirname(dirname(__FILE__)));
$packagereldir = str_replace(getcwd()."/","",dirname(dirname(__FILE__)));
if ($packagereldir == dirname(dirname(__FILE__) )) {
$packagereldir = ".";
}
$makefile = replace($makefile, 'PACKAGINGRELDIR', $packagereldir);
$makefile = template($makefile, $configure, $flags);
$fp = fopen('Makefile', 'w');
if($fp === false) {
die("Error: unable to open the file Makefile for writing.\n");
}
fputs($fp, $makefile);
function checkForCmd($cmd) {
$out = $ret = null;
print " checking for '$cmd': ";
exec('which ' . $cmd, $out, $ret);
if($ret === 0) {
print "ok\n";
} else {
print "not found!\n ***\n";
print " please make sure '$cmd' is installed and in your path before you run 'make'!\n ***\n";
}
}
print "done\n";
print "checking for prerequisites...\n";
checkForCmd('fpm');
checkForCmd('rsync');
print "You can now use `make` to create your package.\n";
print "
********************************************************************************
NOTE:
The package is generated from the files in your working directory. You should
make really sure that you have a clean and up-to-date working directory before
building a package. Or even better use a dedicated working directory for
building packages.
********************************************************************************\n";