From 7ef5e5e118ef9c53ee3ed72243098b404af859ac Mon Sep 17 00:00:00 2001 From: Allen Webster Date: Tue, 27 Dec 2016 15:04:41 -0500 Subject: [PATCH] Updated package setup for new site system and for linux --- build.cpp | 64 +++++++++++++++++++++++++------------------------- package.sh | 7 ++++++ project.4coder | 6 ++--- 3 files changed, 42 insertions(+), 35 deletions(-) create mode 100644 package.sh diff --git a/build.cpp b/build.cpp index 430ea49a..2d543638 100644 --- a/build.cpp +++ b/build.cpp @@ -118,14 +118,14 @@ typedef union _LARGE_INTEGER { extern "C"{ DWORD WINAPI GetCurrentDirectoryA(_In_ DWORD nBufferLength, _Out_ LPTSTR lpBuffer); BOOL WINAPI SetCurrentDirectoryA(_In_ LPCTSTR lpPathName); - + BOOL WINAPI QueryPerformanceCounter(_Out_ LARGE_INTEGER *lpPerformanceCount); - + BOOL WINAPI QueryPerformanceFrequency(_Out_ LARGE_INTEGER *lpFrequency); - + BOOL WINAPI CreateDirectoryA(_In_ LPCTSTR lpPathName, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes); - BOOL WINAPI CopyFileA(_In_ LPCTSTR lpExistingFileName, _In_ LPCTSTR lpNewFileName, _In_ BOOL bFailIfExists); + BOOL WINAPI CopyFileA(_In_ LPCTSTR lpExistingFileName, _In_ LPCTSTR lpNewFileName, _In_ BOOL bFailIfExists); } static uint64_t perf_frequency; @@ -173,7 +173,7 @@ execute(char *dir, char *str, char *args){ if (dir){ Temp_Dir temp = pushdir(dir); if (args){ - systemf("call \"%s\" %s", str, args); + systemf("call \"%s\" %s", str, args); } else{ systemf("call \"%s\"", str); @@ -193,11 +193,11 @@ execute(char *dir, char *str, char *args){ static void slash_fix(char *path){ if (path){ - for (int32_t i = 0; path[i]; ++i){ - if (path[i] == '/') path[i] = '\\'; + for (int32_t i = 0; path[i]; ++i){ + if (path[i] == '/') path[i] = '\\'; + } } } -} static void make_folder_if_missing(char *dir, char *folder){ @@ -207,8 +207,8 @@ make_folder_if_missing(char *dir, char *folder){ String path = make_fixed_width_string(space); append_sc(&path, dir); if (folder){ - append_sc(&path, "\\"); - append_sc(&path, folder); + append_sc(&path, "\\"); + append_sc(&path, folder); } terminate_with_null(&path); @@ -267,7 +267,7 @@ copy_all(char *source, char *tag, char *folder){ slash_fix(source); slash_fix(folder); if (source){ - systemf("copy %s\\%s %s\\*", source, tag, folder); + systemf("copy %s\\%s %s\\*", source, tag, folder); } else{ systemf("copy %s %s\\*", tag, folder); @@ -340,9 +340,9 @@ static void execute(char *dir, char *str, char *args){ if (dir){ if (args){ - Temp_Dir temp = pushdir(dir); - systemf("%s %s", str, args); - popdir(temp); + Temp_Dir temp = pushdir(dir); + systemf("%s %s", str, args); + popdir(temp); } else{ Temp_Dir temp = pushdir(dir); @@ -352,7 +352,7 @@ execute(char *dir, char *str, char *args){ } else{ if (args){ - systemf("%s %s", str, args); + systemf("%s %s", str, args); } else{ systemf("%s", str); @@ -366,7 +366,7 @@ slash_fix(char *path){} static void make_folder_if_missing(char *dir, char *folder){ if (folder){ - systemf("mkdir -p %s/%s", dir, folder); + systemf("mkdir -p %s/%s", dir, folder); } else{ systemf("mkdir -p %s", dir); @@ -386,7 +386,7 @@ copy_file(char *path, char *file, char *folder1, char *folder2, char *newname){ if (path){ if (folder2){ - systemf("cp %s/%s %s/%s/%s", path, file, folder1, folder2, newname); + systemf("cp %s/%s %s/%s/%s", path, file, folder1, folder2, newname); } else{ systemf("cp %s/%s %s/%s", path, file, folder1, newname); @@ -405,7 +405,7 @@ copy_file(char *path, char *file, char *folder1, char *folder2, char *newname){ static void copy_all(char *source, char *tag, char *folder){ if (source){ - systemf("cp -rf %s/%s %s", source, tag, folder); + systemf("cp -rf %s/%s %s", source, tag, folder); } else{ systemf("cp -rf %s %s", tag, folder); @@ -895,28 +895,28 @@ do_buildsuper(char *cdir, int32_t custom_option){ case Custom_Default: { copy_sc(&str, "../code/4coder_default_bindings.cpp"); - terminate_with_null(&str); - buildsuper(cdir, BUILD_DIR, str.str); + terminate_with_null(&str); + buildsuper(cdir, BUILD_DIR, str.str); }break; - + case Custom_Experiments: { #if defined(IS_WINDOWS) - copy_sc(&str, "../code/internal_4coder_tests.cpp"); - terminate_with_null(&str); - buildsuper(cdir, BUILD_DIR, str.str); + copy_sc(&str, "../code/internal_4coder_tests.cpp"); + terminate_with_null(&str); + buildsuper(cdir, BUILD_DIR, str.str); #else - copy_sc(&str, "../code/power/4coder_experiments.cpp"); - terminate_with_null(&str); - buildsuper(cdir, BUILD_DIR, str.str); + copy_sc(&str, "../code/power/4coder_experiments.cpp"); + terminate_with_null(&str); + buildsuper(cdir, BUILD_DIR, str.str); #endif - }break; + }break; - case Custom_Casey: + case Custom_Casey: { copy_sc(&str, "../code/power/4coder_casey.cpp"); - terminate_with_null(&str); - buildsuper(cdir, BUILD_DIR, str.str); + terminate_with_null(&str); + buildsuper(cdir, BUILD_DIR, str.str); }break; case Custom_ChronalVim: @@ -1070,7 +1070,7 @@ package(char *cdir){ get_4coder_dist_name(&str, 0, "API", "html"); str2 = front_of_directory(str); - copy_file(SITE_DIR, "4coder_API.html", PACK_DIR, "super-docs", str2.str); + copy_file(SITE_DIR, "custom_docs.html", PACK_DIR, "super-docs", str2.str); get_4coder_dist_name(&str, 1, "super", "zip"); zip(PACK_SUPER_PAR_DIR, "4coder", str.str); diff --git a/package.sh b/package.sh new file mode 100644 index 00000000..3b6f65f7 --- /dev/null +++ b/package.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +WARNINGS="-Wno-write-strings" +FLAGS="-D_GNU_SOURCE -fPIC -fpermissive -DPACKAGE" + +g++ $WARNINGS $FLAGS build.cpp -g -o ../build/build +../build/build diff --git a/project.4coder b/project.4coder index 3bce181c..b3239444 100644 --- a/project.4coder +++ b/project.4coder @@ -8,7 +8,7 @@ fkey_command_win[4] = {0, 0}; fkey_command_win[5] = {0, 0}; fkey_command_win[6] = {0, 0}; fkey_command_win[7] = {0, 0}; -fkey_command_win[8] = {"package.bat", "*compilation*", true}; +fkey_command_win[8] = {"package.bat", "*package*"}; fkey_command_win[9] = {0, 0}; fkey_command_win[10] = {0, 0}; fkey_command_win[11] = {0, 0}; @@ -18,14 +18,14 @@ fkey_command_win[14] = {0, 0}; fkey_command_win[15] = {0, 0}; fkey_command_win[16] = {0, 0}; -fkey_command_linux[1] = {"make", "*compilation*", true}; +fkey_command_linux[1] = {"./build.sh", "*compilation*", true}; fkey_command_linux[2] = {"../build/4ed", "*run*"}; fkey_command_linux[3] = {"site/build.sh", "*compilation*", true}; fkey_command_linux[4] = {0, 0}; fkey_command_linux[5] = {0, 0}; fkey_command_linux[6] = {0, 0}; fkey_command_linux[7] = {0, 0}; -fkey_command_linux[8] = {"package.sh", "*compilation*", true}; +fkey_command_linux[8] = {"./package.sh", "*package*"}; fkey_command_linux[9] = {0, 0}; fkey_command_linux[10] = {0, 0}; fkey_command_linux[11] = {0, 0};