mirror of
https://github.com/roswell/roswell.git
synced 2026-09-10 07:16:17 -04:00
split cmd_install.c to some files
This commit is contained in:
parent
4e54763243
commit
026ea028f5
|
|
@ -1,3 +1,4 @@
|
|||
AUTOMAKE_OPTIONS = subdir-objects
|
||||
bin_PROGRAMS = lsp
|
||||
lsp_SOURCES = lsp.c opt.c download.c util.c archive.c cmd_version.c cmd_install.c cmd_run.c
|
||||
include_HEADERS = opt.h util.h
|
||||
lsp_SOURCES = lsp.c opt.c download.c util.c archive.c cmd_version.c install/cmd.c cmd_run.c install/sbcl.c
|
||||
include_HEADERS = opt.h util.h install/install.h
|
||||
|
|
|
|||
|
|
@ -1,300 +0,0 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "util.h"
|
||||
|
||||
static int in_resume=0;
|
||||
static char *flags =NULL;
|
||||
typedef int (*install_cmds)(char* impl,char* version);
|
||||
install_cmds *cmds=NULL;
|
||||
|
||||
int installed_p(char* impl,char* version)
|
||||
{
|
||||
int ret;
|
||||
char* i;
|
||||
if(strcmp(impl,"sbcl-bin")==0){
|
||||
impl="sbcl";
|
||||
}
|
||||
i=s_cat(homedir(),q("impls/"),q(impl),q("-"),q(version),q("/"),NULL);
|
||||
ret=directory_exist_p(i);
|
||||
s(i);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int install_running_p(char* impl,char* version)
|
||||
{
|
||||
/* TBD */
|
||||
return 0;
|
||||
}
|
||||
|
||||
int start(char* impl,char* version)
|
||||
{
|
||||
char* home= homedir();
|
||||
char* p;
|
||||
ensure_directories_exist(home);
|
||||
if(installed_p(impl,version)) {
|
||||
printf("%s-%s are already installed.if you intend to reinstall by (TBD).\n",impl,version);
|
||||
return 0;
|
||||
}
|
||||
if(install_running_p(impl,version)) {
|
||||
printf("It seems running installation process for $1-$2.\n");
|
||||
return 0;
|
||||
}
|
||||
if(strcmp(impl,"sbcl")==0 && NULL==get_opt("sbcl.compiler")) {
|
||||
printf("compiler variable 'sbcl.compiler' should be specified\n");
|
||||
return 0;
|
||||
}
|
||||
/*trap "exit 1" HUP INT PIPE QUIT TERM*/
|
||||
/*trap "rm -f $CIM_HOME/tmp/$1-$2.lock" EXIT*/
|
||||
p=cat(home,"tmp/",impl,"-",version,"/",NULL);
|
||||
ensure_directories_exist(p);
|
||||
s(p);
|
||||
|
||||
p=cat(home,"tmp/",impl,"-",version,".lock",NULL);
|
||||
touch(p);
|
||||
s(p);
|
||||
s(home);
|
||||
return 1;
|
||||
}
|
||||
|
||||
char* bz2distp(char* impl)
|
||||
{
|
||||
/* TBD rename function */
|
||||
if(strcmp(impl,"sbcl")==0||
|
||||
strcmp(impl,"sbcl-bin")==0||
|
||||
strcmp(impl,"alisp")==0) {
|
||||
return "bz2";
|
||||
}
|
||||
return "gz";
|
||||
}
|
||||
|
||||
char* get_default_version(char* impl)
|
||||
{
|
||||
/* TBD */
|
||||
if(strcmp(impl,"sbcl")==0) {
|
||||
return q("1.2.1");
|
||||
}else if(strcmp(impl,"sbcl-bin")==0) {
|
||||
return s_cat(get_default_version("sbcl"),q("-"),uname_m(),q("-"),uname(),NULL);
|
||||
}
|
||||
}
|
||||
|
||||
char* get_download_path(char** impl,char** version)
|
||||
{
|
||||
if(strcmp(*impl,"sbcl")==0 && *version) {
|
||||
return cat("http://sourceforge.net/projects/sbcl/files/sbcl/",*version,
|
||||
"/sbcl-",*version,"-source.tar.bz2",NULL);
|
||||
}else if(strcmp(*impl,"sbcl-bin")==0) {
|
||||
return q("http://prdownloads.sourceforge.net/sbcl/sbcl-1.2.1-x86-64-linux-binary.tar.bz2");
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int download(char* impl,char* version)
|
||||
{
|
||||
char* home= homedir();
|
||||
char* url;
|
||||
char* impl_archive;
|
||||
printf("Donwloading archive.\n");
|
||||
url=get_download_path(&impl,&version);
|
||||
if(url) {
|
||||
impl_archive=cat(home,"archives/",impl,"-",version,".tar.",bz2distp(impl),NULL);
|
||||
ensure_directories_exist(impl_archive);
|
||||
|
||||
/* pipe connect for logging cim_with_output_control */
|
||||
if(download_simple(url,impl_archive,0)) {
|
||||
printf("Failed to Download.\n");
|
||||
return 0;
|
||||
/* fail */
|
||||
}else{
|
||||
printf("download done:%s\n",url);
|
||||
}
|
||||
}
|
||||
s(impl_archive);
|
||||
s(url);
|
||||
s(home);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int expand(char* impl,char* version)
|
||||
{
|
||||
char* home= homedir();
|
||||
char* argv[5]={"-xf",NULL,"-C",NULL,NULL};
|
||||
int argc=4;
|
||||
char* archive;
|
||||
char* dist_path;
|
||||
|
||||
archive=cat(impl,"-",version,".tar.",bz2distp(impl),NULL);
|
||||
if(strcmp(impl,"sbcl-bin")==0) {
|
||||
impl="sbcl";
|
||||
}else {
|
||||
}
|
||||
version=q(version);
|
||||
dist_path=cat(home,"src/",impl,"-",version,"/",NULL);
|
||||
|
||||
printf("Extracting archive. %s to %s\n",archive,dist_path);
|
||||
|
||||
delete_directory(dist_path,1);
|
||||
ensure_directories_exist(dist_path);
|
||||
|
||||
/* pipe connect for logging cim_with_output_control */
|
||||
argv[1]=cat(home,"archives/",archive,NULL);
|
||||
argv[3]=cat(home,"src/",NULL);
|
||||
cmd_tar(argc,argv);
|
||||
|
||||
s(argv[1]);
|
||||
s(argv[3]);
|
||||
s(dist_path);
|
||||
s(archive);
|
||||
s(home);
|
||||
s(version);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int configure(char* impl,char* version)
|
||||
{
|
||||
char* home= homedir();
|
||||
char* confgcache= cat(home,"/src/",impl,"-",version,"/src/confg.cache",NULL);
|
||||
char* cd;
|
||||
char* configure;
|
||||
int ret;
|
||||
if(in_resume) {
|
||||
delete_file(confgcache);
|
||||
}
|
||||
if(flags==NULL) {
|
||||
flags=q("");
|
||||
}
|
||||
if(strcmp("gcl",impl)==0) {
|
||||
flags=s_cat(flags,q(" --enable-ansi"));
|
||||
}
|
||||
if(strcmp("ecl",impl)==0 ||strcmp("ecl",impl)==0 || strcmp("clisp",impl)==0) {
|
||||
flags=s_cat(flags,q(" --mandir="),q(home),q("/share/man"));
|
||||
}
|
||||
printf("Configuring %s-%s\n",impl,version);
|
||||
cd=cat(home,"src/",impl,"-",version,NULL);
|
||||
printf ("cd:%s\n",cd);
|
||||
change_directory(cd);
|
||||
/* pipe connect for logging cim_with_output_control */
|
||||
configure=cat("./configure ",flags," --prefix=",home,"/impls/",impl,"-",version,NULL);
|
||||
ret=system(configure);
|
||||
s(configure);
|
||||
s(cd);
|
||||
s(confgcache);
|
||||
s(home);
|
||||
}
|
||||
|
||||
/*int sbcl_ensure_impl(char* impl,char* version) {
|
||||
int ret=1;
|
||||
char* bin_version;
|
||||
printf((bin_version=q("Finding Lisp impl to build sbcl.\n")));
|
||||
char* sbcl_bin_url=get_download_path("sbcl-bin",bin_version);
|
||||
if(sbcl_bin_url){
|
||||
if(!directory_exist_p()) {
|
||||
|
||||
}
|
||||
s(sbcl_bin_url);
|
||||
}else {
|
||||
printf("can't download sbcl\n");
|
||||
ret=0;
|
||||
}
|
||||
s(bin_version);
|
||||
return ret;
|
||||
}
|
||||
*/
|
||||
|
||||
int sbcl_make(char* impl,char* version) {
|
||||
char* home=homedir();
|
||||
char* src=cat(home,"src/",impl,"-",version,NULL);
|
||||
char* compiler=cat(argv_orig[0]," -impl ",get_opt("sbcl.compiler")," run",NULL);
|
||||
char* cmd=cat("sh make.sh \"",compiler,"\" ","--prefix=\"",home,"impls/",impl,"-",version,"\"",NULL);
|
||||
printf("Building %s-%s\n",impl,version);
|
||||
change_directory(src);
|
||||
printf("cmd:%s\n",cmd);
|
||||
system(cmd);
|
||||
/* pipe connect for logging cim_with_output_control */
|
||||
s(home),s(src),s(cmd),s(compiler);
|
||||
}
|
||||
|
||||
int sbcl_install(char* impl,char* version) {
|
||||
#ifndef _WIN32
|
||||
int ret=1;
|
||||
char* home= homedir();
|
||||
if(strcmp(impl,"sbcl-bin")==0) {
|
||||
impl="sbcl";
|
||||
}
|
||||
char* impl_path= cat(home,"impls/",impl,"-",version,NULL);
|
||||
char* src=cat(home,"src/",impl,"-",version,NULL);
|
||||
char* sbcl_home=cat(impl_path,"/lib/sbcl",NULL);
|
||||
char* install_root=q(impl_path);
|
||||
impl="sbcl";
|
||||
printf("installing %s-%s\n",impl,version);
|
||||
ensure_directories_exist(impl_path);
|
||||
printf("cd:%s\n",src);
|
||||
change_directory(src);
|
||||
setenv("SBCL_HOME",sbcl_home,1);
|
||||
setenv("INSTALL_ROOT",install_root,1);
|
||||
if(system_redirect("sh install.sh","/tmp/hoge")==-1) {
|
||||
ret=0;
|
||||
}
|
||||
s(home);
|
||||
s(impl_path);
|
||||
s(src);
|
||||
s(sbcl_home);
|
||||
s(install_root);
|
||||
return ret;
|
||||
#else
|
||||
#error not implemented.
|
||||
#endif
|
||||
}
|
||||
|
||||
install_cmds install_full[]={
|
||||
start,
|
||||
download,
|
||||
expand,
|
||||
configure,
|
||||
NULL
|
||||
};
|
||||
install_cmds install_sbcl_full[]={
|
||||
start,
|
||||
download,
|
||||
expand,
|
||||
sbcl_make,
|
||||
sbcl_install,
|
||||
NULL
|
||||
};
|
||||
|
||||
install_cmds install_sbcl_bin_full[]={
|
||||
start,
|
||||
download,
|
||||
expand,
|
||||
sbcl_install,
|
||||
NULL
|
||||
};
|
||||
|
||||
int cmd_install(int argc,char **argv)
|
||||
{
|
||||
int ret=1;
|
||||
if(argc!=0) {
|
||||
char* impl=q(argv[0]);
|
||||
char* version=NULL;
|
||||
if(strcmp(impl,"sbcl-bin")==0) {
|
||||
cmds=install_sbcl_bin_full;
|
||||
}else if(strcmp(impl,"sbcl")==0) {
|
||||
cmds=install_sbcl_full;
|
||||
}else {
|
||||
printf("%s is not implemented for install.\n",impl);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
if(argc==1) {
|
||||
version=get_default_version(impl);
|
||||
}else {
|
||||
version=q(argv[1]);
|
||||
}
|
||||
for(;*cmds&&ret;++cmds) {
|
||||
ret=(*cmds)(impl,version);
|
||||
}
|
||||
s(version);
|
||||
}else {
|
||||
printf("what would you like to install?\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
2
src/install/Makefile.am
Normal file
2
src/install/Makefile.am
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
noinst_LIBRARIES = cmd_install.a
|
||||
cmd_install_a_SOURCES = sbcl.c
|
||||
199
src/install/cmd.c
Normal file
199
src/install/cmd.c
Normal file
|
|
@ -0,0 +1,199 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "util.h"
|
||||
#include "install/install.h"
|
||||
static int in_resume=0;
|
||||
static char *flags =NULL;
|
||||
struct install_impls *install_impl;
|
||||
|
||||
struct install_impls *impls_to_install[]={
|
||||
&impls_sbcl_bin,
|
||||
&impls_sbcl
|
||||
};
|
||||
|
||||
int installed_p(char* impl,char* version)
|
||||
{
|
||||
int ret;
|
||||
char* i;
|
||||
int pos;
|
||||
pos=position_char("-",impl);
|
||||
if(pos!=-1) {
|
||||
impl=subseq(impl,0,pos);
|
||||
}else
|
||||
impl=q(impl);
|
||||
i=s_cat(homedir(),q("impls/"),q(impl),q("-"),q(version),q("/"),NULL);
|
||||
ret=directory_exist_p(i);
|
||||
s(i),s(impl);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int install_running_p(char* impl,char* version)
|
||||
{
|
||||
/* TBD */
|
||||
return 0;
|
||||
}
|
||||
|
||||
int start(char* impl,char* version)
|
||||
{
|
||||
char* home= homedir();
|
||||
char* p;
|
||||
ensure_directories_exist(home);
|
||||
if(installed_p(impl,version)) {
|
||||
printf("%s-%s are already installed.if you intend to reinstall by (TBD).\n",impl,version);
|
||||
return 0;
|
||||
}
|
||||
if(install_running_p(impl,version)) {
|
||||
printf("It seems running installation process for $1-$2.\n");
|
||||
return 0;
|
||||
}
|
||||
if(strcmp(impl,"sbcl")==0 && !get_opt("sbcl.compiler")) {
|
||||
printf("compiler variable 'sbcl.compiler' should be specified\n");
|
||||
return 0;
|
||||
}
|
||||
/*TBD trap "exit 1" HUP INT PIPE QUIT TERM
|
||||
trap "rm -f $CIM_HOME/tmp/$1-$2.lock" EXIT*/
|
||||
p=cat(home,"tmp/",impl,"-",version,"/",NULL);
|
||||
ensure_directories_exist(p);
|
||||
s(p);
|
||||
|
||||
p=cat(home,"tmp/",impl,"-",version,".lock",NULL);
|
||||
touch(p);
|
||||
s(p);
|
||||
s(home);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int download(char* impl,char* version)
|
||||
{
|
||||
char* home= homedir();
|
||||
char* url;
|
||||
char* impl_archive;
|
||||
printf("Downloading archive.\n");
|
||||
url=(*(install_impl->uri))(impl,version);//get_download_path(impl,version);
|
||||
/*TBD proxy support... etc*/
|
||||
if(get_opt("skip.download")) {
|
||||
printf("Skip downloading %s\n",url);
|
||||
}else {
|
||||
if(url) {
|
||||
impl_archive=cat(home,"archives/",impl,"-",version,".",(*(install_impl->extention))(impl,version),NULL);
|
||||
ensure_directories_exist(impl_archive);
|
||||
|
||||
if(download_simple(url,impl_archive,0)) {
|
||||
printf("Failed to Download.\n");
|
||||
return 0;
|
||||
/* fail */
|
||||
}else{
|
||||
printf("download done:%s\n",url);
|
||||
}
|
||||
}
|
||||
s(impl_archive),s(url);
|
||||
}
|
||||
s(home);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int expand(char* impl,char* version)
|
||||
{
|
||||
char* home= homedir();
|
||||
char* argv[5]={"-xf",NULL,"-C",NULL,NULL};
|
||||
int argc=4;
|
||||
int pos;
|
||||
char* archive;
|
||||
char* dist_path;
|
||||
archive=cat(impl,"-",version,".",(*(install_impl->extention))(impl,version),NULL);
|
||||
pos=position_char("-",impl);
|
||||
if(pos!=-1) {
|
||||
impl=subseq(impl,0,pos);
|
||||
}else
|
||||
impl=q(impl);
|
||||
version=q(version);
|
||||
dist_path=cat(home,"src/",impl,"-",version,"/",NULL);
|
||||
|
||||
printf("Extracting archive. %s to %s\n",archive,dist_path);
|
||||
|
||||
delete_directory(dist_path,1);
|
||||
ensure_directories_exist(dist_path);
|
||||
|
||||
/* TBD log output */
|
||||
argv[1]=cat(home,"archives/",archive,NULL);
|
||||
argv[3]=cat(home,"src/",NULL);
|
||||
cmd_tar(argc,argv);
|
||||
|
||||
s(argv[1]),s(argv[3]);
|
||||
s(impl);
|
||||
s(dist_path);
|
||||
s(archive);
|
||||
s(home);
|
||||
s(version);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int configure(char* impl,char* version)
|
||||
{
|
||||
char* home= homedir();
|
||||
char* confgcache= cat(home,"/src/",impl,"-",version,"/src/confg.cache",NULL);
|
||||
char* cd;
|
||||
char* configure;
|
||||
int ret;
|
||||
if(in_resume) {
|
||||
delete_file(confgcache);
|
||||
}
|
||||
if(flags==NULL) {
|
||||
flags=q("");
|
||||
}
|
||||
if(strcmp("gcl",impl)==0) {
|
||||
flags=s_cat(flags,q(" --enable-ansi"));
|
||||
}
|
||||
if(strcmp("ecl",impl)==0 ||strcmp("ecl",impl)==0 || strcmp("clisp",impl)==0) {
|
||||
flags=s_cat(flags,q(" --mandir="),q(home),q("/share/man"));
|
||||
}
|
||||
printf("Configuring %s-%s\n",impl,version);
|
||||
cd=cat(home,"src/",impl,"-",version,NULL);
|
||||
printf ("cd:%s\n",cd);
|
||||
change_directory(cd);
|
||||
/* pipe connect for logging cim_with_output_control */
|
||||
configure=cat("./configure ",flags," --prefix=",home,"/impls/",impl,"-",version,NULL);
|
||||
ret=system(configure);
|
||||
s(configure);
|
||||
s(cd);
|
||||
s(confgcache);
|
||||
s(home);
|
||||
}
|
||||
|
||||
install_cmds install_full[]={
|
||||
start,
|
||||
download,
|
||||
expand,
|
||||
configure,
|
||||
NULL
|
||||
};
|
||||
|
||||
int cmd_install(int argc,char **argv)
|
||||
{
|
||||
int ret=1;
|
||||
install_cmds *cmds=NULL;
|
||||
if(argc!=0) {
|
||||
char* impl=q(argv[0]);
|
||||
char* version=NULL;
|
||||
int i;
|
||||
for(install_impl=NULL,i=0;i<sizeof(impls_to_install)/sizeof(struct install_impls*);++i) {
|
||||
struct install_impls* j=impls_to_install[i];
|
||||
if(strcmp(impl,j->name)==0) {
|
||||
install_impl=j;
|
||||
}
|
||||
}
|
||||
if(!install_impl) {
|
||||
printf("%s is not implemented for install.\n",impl);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
version=(*(install_impl->version))(impl,argc==1?NULL:argv[1]);
|
||||
for(cmds=install_impl->call;*cmds&&ret;++cmds) {
|
||||
ret=(*cmds)(impl,version);
|
||||
}
|
||||
s(version);
|
||||
}else {
|
||||
printf("what would you like to install?\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
26
src/install/install.h
Normal file
26
src/install/install.h
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#ifndef __INSTALL_H__
|
||||
#define __INSTALL_H__
|
||||
|
||||
typedef int (*install_cmds)(char* impl,char* version);
|
||||
typedef char* (*install_cmd_string)(char* impl,char* version);
|
||||
int start(char* impl,char* version);
|
||||
int download(char* impl,char* version);
|
||||
int expand(char* impl,char* version);
|
||||
|
||||
extern install_cmds install_sbcl_full[];
|
||||
extern install_cmds install_sbcl_bin_full[];
|
||||
|
||||
struct install_impls
|
||||
{
|
||||
const char* name;
|
||||
install_cmds *call;
|
||||
install_cmd_string version;
|
||||
install_cmd_string uri;
|
||||
install_cmd_string extention;
|
||||
|
||||
};
|
||||
|
||||
extern struct install_impls impls_sbcl_bin;
|
||||
extern struct install_impls impls_sbcl;
|
||||
|
||||
#endif
|
||||
112
src/install/sbcl.c
Normal file
112
src/install/sbcl.c
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
#include <stdio.h>
|
||||
#include "util.h"
|
||||
#include "install.h"
|
||||
#include "opt.h"
|
||||
|
||||
int sbcl_start(char* impl,char* version)
|
||||
{
|
||||
if(strcmp(impl,"sbcl")==0 && !get_opt("sbcl.compiler")) {
|
||||
printf("compiler variable 'sbcl.compiler' should be specified\n");
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int sbcl_make(char* impl,char* version) {
|
||||
char* home=homedir();
|
||||
char* src=cat(home,"src/",impl,"-",version,NULL);
|
||||
char* compiler=cat(argv_orig[0]," -impl ",get_opt("sbcl.compiler")," run",NULL);
|
||||
char* cmd=cat("sh make.sh \"",compiler,"\" ","--prefix=",home,"impls/",impl,"-",version,NULL);
|
||||
char* log_path=cat(home,"impls/log/",impl,"-",version,"/make.log",NULL);
|
||||
|
||||
printf("Building %s-%s\n",impl,version);
|
||||
change_directory(src);
|
||||
ensure_directories_exist(log_path);
|
||||
printf("cmd:%s\n",cmd);
|
||||
if(system_redirect(cmd,log_path)==-1) {
|
||||
return 0;
|
||||
}
|
||||
s(home),s(src),s(cmd),s(compiler),s(log_path);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int sbcl_install(char* impl,char* version) {
|
||||
#ifndef _WIN32
|
||||
int ret=1;
|
||||
char* home= homedir();
|
||||
if(strcmp(impl,"sbcl-bin")==0) {
|
||||
impl="sbcl";
|
||||
}
|
||||
char* impl_path= cat(home,"impls/",impl,"-",version,NULL);
|
||||
char* src=cat(home,"src/",impl,"-",version,NULL);
|
||||
char* sbcl_home=cat(impl_path,"/lib/sbcl",NULL);
|
||||
char* install_root=q(impl_path);
|
||||
char* log_path=cat(home,"impls/log/",impl,"-",version,"/install.log",NULL);
|
||||
impl="sbcl";
|
||||
printf("installing %s-%s\n",impl,version);
|
||||
ensure_directories_exist(impl_path);
|
||||
ensure_directories_exist(log_path);
|
||||
change_directory(src);
|
||||
setenv("SBCL_HOME",sbcl_home,1);
|
||||
setenv("INSTALL_ROOT",install_root,1);
|
||||
|
||||
if(system_redirect("sh install.sh",log_path)==-1) {
|
||||
ret=0;
|
||||
}
|
||||
s(home),s(impl_path),s(src),s(sbcl_home),s(install_root),s(log_path);
|
||||
|
||||
return ret;
|
||||
#else
|
||||
#error not implemented.
|
||||
#endif
|
||||
}
|
||||
|
||||
char* _version(char* impl,char* version)
|
||||
{
|
||||
/* TBD */
|
||||
if(version) {
|
||||
return q(version);
|
||||
}
|
||||
if(strcmp(impl,"sbcl")==0) {
|
||||
return q("1.2.1");
|
||||
}else if(strcmp(impl,"sbcl-bin")==0) {
|
||||
return s_cat(_version("sbcl",NULL),q("-"),uname_m(),q("-"),uname(),NULL);
|
||||
}
|
||||
}
|
||||
|
||||
char* uri(char* impl,char* version)
|
||||
{
|
||||
if(strcmp(impl,"sbcl")==0 && version) {
|
||||
return cat("http://sourceforge.net/projects/sbcl/files/sbcl/",version,
|
||||
"/sbcl-",version,"-source.tar.bz2",NULL);
|
||||
}else if(strcmp(impl,"sbcl-bin")==0) {
|
||||
return q("http://prdownloads.sourceforge.net/sbcl/sbcl-1.2.1-x86-64-linux-binary.tar.bz2");
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char* extention(char* impl,char* version)
|
||||
{
|
||||
return "tar.bz2";
|
||||
}
|
||||
|
||||
install_cmds install_sbcl_bin_full[]={
|
||||
start,
|
||||
download,
|
||||
expand,
|
||||
sbcl_install,
|
||||
NULL
|
||||
};
|
||||
|
||||
install_cmds install_sbcl_full[]={
|
||||
sbcl_start,
|
||||
start,
|
||||
download,
|
||||
expand,
|
||||
sbcl_make,
|
||||
sbcl_install,
|
||||
NULL
|
||||
};
|
||||
|
||||
struct install_impls impls_sbcl_bin={ "sbcl-bin", install_sbcl_bin_full,_version,uri,extention};
|
||||
struct install_impls impls_sbcl={ "sbcl", install_sbcl_full,_version,uri,extention};
|
||||
|
|
@ -351,8 +351,7 @@ char** parse_cmdline(char* cmdline,int *argc)
|
|||
int count,last;
|
||||
char** ret;
|
||||
for(write=0;write<2;++write) {
|
||||
last=0;
|
||||
count=0;
|
||||
last=0,mode=0,count=0;
|
||||
for(i=0;cmdline[i]!='\0';++i) {
|
||||
if(cmdline[i]==' '||cmdline[i]=='\t') {
|
||||
if(i!=0) {
|
||||
|
|
@ -377,7 +376,7 @@ char** parse_cmdline(char* cmdline,int *argc)
|
|||
}
|
||||
if(last+1!=i) {
|
||||
if(write) {
|
||||
ret[count]=subseq(cmdline,last,i);
|
||||
ret[count]=subseq(cmdline,last,i-mode);
|
||||
if(mode) {
|
||||
ret[count]=s_decode(ret[count]);
|
||||
mode=0;
|
||||
|
|
|
|||
Loading…
Reference in a new issue