actually fixed site building system

This commit is contained in:
Allen Webster 2016-11-14 01:39:03 -05:00
parent 108250307a
commit 25d4e979b0
1 changed files with 52 additions and 10 deletions

View File

@ -75,7 +75,7 @@ static int32_t prev_error = 0;
static void init_time_system();
static uint64_t get_time();
static int32_t get_current_directory(char *buffer, int32_t max);
static void execute(char *dir, char *str);
static void execute(char *dir, char *str, char *args);
static void make_folder_if_missing(char *dir, char *folder);
static void clear_folder(char *folder);
@ -142,13 +142,23 @@ get_current_directory(char *buffer, int32_t max){
}
static void
execute(char *dir, char *str){
execute(char *dir, char *str, char *args){
if (dir){
if (args){
systemf("pushd %s & call \"%s\" %s", dir, str, args);
}
else{
systemf("pushd %s & call \"%s\"", dir, str);
}
}
else{
if (args){
systemf("call \"%s\" %s", str, args);
}
else{
systemf("call \"%s\"", str);
}
}
}
static void
@ -299,15 +309,27 @@ get_current_directory(char *buffer, int32_t max){
}
static void
execute(char *dir, char *str){
execute(char *dir, char *str, char *args){
if (dir){
if (args){
Temp_Dir temp = linux_pushd(dir);
systemf("%s %s", str, args);
linux_popd(temp);
}
else{
Temp_Dir temp = linux_pushd(dir);
systemf("%s", str);
linux_popd(temp);
}
}
else{
if (args){
systemf("%s %s", str, args);
}
else{
systemf("%s", str);
}
}
}
static void
@ -685,6 +707,7 @@ buildsuper(char *code_path, char *out_path, char *filename){
#define D_META_GEN_DIR "../meta/metagen"
#define D_BUILD_DIR "../build"
#define D_BUILD_SITE_DIR "../build/site"
#define D_SITE_GEN_DIR "../../build/site/sitegen"
#define D_PACK_DIR "../distributions"
#define D_PACK_DATA_DIR "../data/dist_files"
@ -703,6 +726,7 @@ static char *META_FSM_DIR = 0;
static char *META_GEN_DIR = 0;
static char *BUILD_DIR = 0;
static char *BUILD_SITE_DIR = 0;
static char *SITE_GEN_DIR = 0;
static char *PACK_DIR = 0;
static char *PACK_DATA_DIR = 0;
static char *DATA_DIR = 0;
@ -745,6 +769,10 @@ init_global_strings(){
append_sc(&builder, D_BUILD_SITE_DIR);
append_ss(&builder, term);
SITE_GEN_DIR = get_head(builder);
append_sc(&builder, D_SITE_GEN_DIR);
append_ss(&builder, term);
PACK_DIR = get_head(builder);
append_sc(&builder, D_PACK_DIR);
append_ss(&builder, term);
@ -801,7 +829,7 @@ fsm_generator(char *cdir){
if (prev_error == 0){
BEGIN_TIME_SECTION();
execute(cdir, META_FSM_DIR);
execute(cdir, META_FSM_DIR, 0);
END_TIME_SECTION("run fsm generator");
}
}
@ -816,7 +844,7 @@ metagen(char *cdir){
if (prev_error == 0){
BEGIN_TIME_SECTION();
execute(cdir, META_GEN_DIR);
execute(cdir, META_GEN_DIR, 0);
END_TIME_SECTION("run metagen");
}
}
@ -874,9 +902,23 @@ standard_build(char *cdir, uint32_t flags){
static void
site_build(char *cdir, uint32_t flags){
{
BEGIN_TIME_SECTION();
build(OPTS | SITE_INCLUDES | flags, cdir, "site/sitegen.cpp", BUILD_SITE_DIR, "sitegen", 0);
END_TIME_SECTION("build site");
END_TIME_SECTION("build sitegen");
}
{
BEGIN_TIME_SECTION();
#if defined(IS_WINDOWS)
systemf("pushd %s\\site & ..\\..\\build\\site\\sitegen .. source_material ..\\..\\site", cdir);
#else
systemf("pushd %s/site & ../../build/site/sitegen .. source_material ../../site", cdir);
#endif
END_TIME_SECTION("run metagen");
}
}
static void