started cleaning up site build

master
Allen Webster 2017-07-08 23:25:29 -04:00
parent 7393c881a6
commit f76b564d95
4 changed files with 17 additions and 49 deletions

9
build_site.sh Normal file → Executable file
View File

@ -1,10 +1,5 @@
#!/bin/bash
WARNINGS="-Wno-write-strings"
FLAGS="-D_GNU_SOURCE -fPIC -fpermissive -DSITE_BUILD"
BASEDIR="$PWD"
g++ $WARNINGS $FLAGS $BASEDIR/meta/build.cpp -g -o ../build/build
../build/build
chmod 777 build.sh
./build.sh "-DSITE_BUILD"

View File

@ -195,7 +195,7 @@ get_defines_from_flags(u32 flags){
static void
build(u32 flags, u32 arch, char *code_path, char **code_files, char *out_path, char *out_file, char **defines, char **exports, char **inc_folders){
Temp_Dir temp = fm_pushdir(out_path);
Build_Line line;
fm_init_build_line(&line);
@ -413,7 +413,6 @@ build(u32 flags, u32 arch, char *code_path, char *code_file, char *out_path, cha
char *code_files[2];
code_files[0] = code_file;
code_files[1] = 0;
build(flags, arch, code_path, code_files, out_path, out_file, defines, exports, inc_folders);
}
@ -430,8 +429,12 @@ site_build(char *cdir, u32 flags){
{
BEGIN_TIME_SECTION();
char *cmd = fm_str(BUILD_DIR"/sitegen");
char *args = fm_str(". ../site_resources site/source_material ../site");
systemf("%s %s", cmd, args);
char *code_dir = fm_str(".");
char *asset_dir = fm_str("../site_resources");
char *site_source_dir = fm_str("site/source_material");
char *dest_dir = fm_str("../site");
fm_make_folder_if_missing(dest_dir);
systemf("%s %s %s %s %s", cmd, code_dir, asset_dir, site_source_dir, dest_dir);
END_TIME_SECTION("run sitegen");
}
}

View File

@ -87,19 +87,16 @@ do_file_copy(Partition *part, char *src_file, char *dst_dir, char *dst_file){
if (in){
fseek(in, 0, SEEK_END);
int32_t file_size = ftell(in);
if (mem_size >= file_size){
fseek(in, 0, SEEK_SET);
fread(mem, 1, file_size, in);
FILE *out = fopen(dst, "wb");
if (out){
fwrite(mem, 1, file_size, out);
fclose(out);
success = 1;
fseek(in, 0, SEEK_SET);
fread(mem, 1, file_size, in);
FILE *out = fopen(dst, "wb");
if (out){
fwrite(mem, 1, file_size, out);
fclose(out);
success = 1;
}
}
}
fclose(in);
}
end_temp_memory(temp);

View File

@ -95,33 +95,6 @@ allocate_app_api(Partition *part, i32 count){
return(app_api);
}
static void
assert_files_are_equal(char *directory, char *filename1, char *filename2){
char space[256];
String name = make_fixed_width_string(space);
append_sc(&name, directory);
append_sc(&name, "/");
append_sc(&name, filename1);
terminate_with_null(&name);
String file1 = file_dump(name.str);
name.size = 0;
append_sc(&name, directory);
append_sc(&name, "/");
append_sc(&name, filename2);
terminate_with_null(&name);
String file2 = file_dump(name.str);
if (!match_ss(file1, file2)){
fprintf(stderr, "Failed transitional test: %s != %s\n", filename1, filename2);
}
else{
fprintf(stderr, "Passed transitional test: %s == %s\n", filename1, filename2);
}
}
static void
do_html_output(Document_System *doc_system, Partition *part, char *dst_directory, Abstract_Item *doc){
// NOTE(allen): Output