From 796595aaa60314add50b6a9e5e728a1b9ec36e15 Mon Sep 17 00:00:00 2001 From: "sigonasr2, Sig, Sigo" Date: Wed, 29 Jun 2022 17:46:30 +0000 Subject: [PATCH] Update README, include sample build program, setup custom build options and sample variables Co-authored-by: sigonasr2 --- C/scripts/build.sh | 2 +- CProjectTemplate | Bin 0 -> 16696 bytes Java/scripts/build.sh | 17 -------------- Java/scripts/build2.sh | 17 -------------- Java/scripts/clean.sh | 4 ---- Java/scripts/commit.sh | 20 ---------------- Java/scripts/filelist | 10 -------- Java/scripts/jar.sh | 17 -------------- Java/scripts/jar2.sh | 17 -------------- Java/scripts/md5 | 9 ------- Java/scripts/release.sh | 28 ---------------------- Java/scripts/update.sh | 3 --- Java/scripts/version_info | 3 --- Java/scripts/zip.sh | 14 ----------- README.md | 48 ++++++++++++++------------------------ main.c | 5 ++++ scripts/commit.sh | 32 ------------------------- scripts/filelist | 2 -- scripts/md5 | 2 -- scripts/update.sh | 3 --- sig | 14 ++++------- 21 files changed, 27 insertions(+), 240 deletions(-) mode change 100644 => 100755 C/scripts/build.sh create mode 100755 CProjectTemplate delete mode 100755 Java/scripts/build.sh delete mode 100644 Java/scripts/build2.sh delete mode 100755 Java/scripts/clean.sh delete mode 100755 Java/scripts/commit.sh delete mode 100644 Java/scripts/filelist delete mode 100755 Java/scripts/jar.sh delete mode 100755 Java/scripts/jar2.sh delete mode 100644 Java/scripts/md5 delete mode 100644 Java/scripts/release.sh delete mode 100755 Java/scripts/update.sh delete mode 100644 Java/scripts/version_info delete mode 100644 Java/scripts/zip.sh create mode 100644 main.c delete mode 100755 scripts/commit.sh delete mode 100644 scripts/filelist delete mode 100644 scripts/md5 delete mode 100755 scripts/update.sh diff --git a/C/scripts/build.sh b/C/scripts/build.sh old mode 100644 new mode 100755 index d3b2ff9..776382d --- a/C/scripts/build.sh +++ b/C/scripts/build.sh @@ -1,5 +1,5 @@ #Compiles the entire program then runs it, producing an executable. #C -if gcc $(find . -type f -name "*.c") -lncurses -o ${PROJECT_NAME}; then +if gcc $(find . -type f -name "*.c") ${BUILD_OPTIONS} -o ${PROJECT_NAME}; then ./${PROJECT_NAME} fi \ No newline at end of file diff --git a/CProjectTemplate b/CProjectTemplate new file mode 100755 index 0000000000000000000000000000000000000000..deadea398858006a6c816b2cd5e892b6f935c76e GIT binary patch literal 16696 zcmeHOZ)_Y#6`%9j@ujiPm(-z7QsNB_C?WC2P95VEOz!+Id)4I+iA{`}baVEt?SuPc z?)F-{f?{x6_0$@yN~jf7Y9k?mR4ReQhwuS#2$Uevs`&ziQV|NFE=r3NQWT)c@!srv z=iT)=NQF{HIdAU9XjUg%WyNoAM0TQF#4x4bgMHY+GT}~XL`c4wE9g1joj_l5n9pfU^$H?)- znBb?A;^{^O$}lPNTL`z^5ZSr0m-HF24opWcnu+&P-(j+ARHPf>My`jE>-z-Q@sL`U zH~;2gK0@`aG!7cYpOL~VcBPWT9qqePiI!9{Q1>89bxXCPA~vgvqRg@O3H)2SJrp)3SEJUQ)CazP`ML?OwF>6x z`ea@Z9|&9J%(MIo4hSS1ORSI61sl(E2+J01JYNgQFWPu{UqceoH5+fgUS1}?7Ie7J z(!l%jBH%^9i+~paF9Kc!ya;#^_`iz4UmG_6Lz}r2&>pM#^)4Z_hv&_z(#zV+PXcFU z97=n>2K1HE2fq%`&@51Y980de`TJ6-G>0;jJ}*mqg)9fTV3*t8iWbk`s}*0@X8yQ% zcpx@ga~~{ywb}X-_|ay&&H$9w9|4oAb0AJZMw_k4A?&?ou7{?nn1`mVE?sD7o(6Ss zmJsx#Qh!f3!uA_laZx+-_CD>*HNWP2K|6oLYy<~2TrXcI*@)^2uoNmyy9}@tw#(r1VR(!j+_(r7E_&aUptWVqfTH(()e)pV+ z9FLrc+#Au)jxN=R&BT#Kl;d6=Y1ts}%Zq>)0WShx1iT1%5%415MZk-I7XdE~zyXo8H|7aKx-xbv@mP#hzPQa%DKL+?cz!>0hz&)2srC$K1 z051Xl7O)+j?(y9xCf@@`gl{tB+f-K@m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T8U&vFXRpA;!^7{NFWdA^W;VzyU}$xUBdywV>cDg(l}4=IGZNa{8ZYE4+EMx z3&%MJM}LgmgiteC(@@7U1$82qoiK9dl#LoLB;ov3GC@?NJKAE#$AnZLkLSmQnwZK! z6&9K~tK>c-mrrIh4nc>qoRNy70p%uArchv{%rb}Q3Kgbz8m6rKT6qsL{?fsv2lr4b@j8o<*XvX) zbvciC2Yhgi%=Ww=k+4vx2Rt1BgUES`FSA;9Cn%Qd0ol)5R};y`mm?Z zf`HEuY|raYMqGzr;`Xy15;x+aX<-;Z4Oyv}E==Y|uyd_8XH{(E>Zjo3l>46 literal 0 HcmV?d00001 diff --git a/Java/scripts/build.sh b/Java/scripts/build.sh deleted file mode 100755 index c5b6b67..0000000 --- a/Java/scripts/build.sh +++ /dev/null @@ -1,17 +0,0 @@ -#Builds and runs the project. -#Java -source ${LANGUAGE}/scripts/version_info -javac -source ${SOURCE_VERSION} -target ${TARGET_VERSION} -Xlint:unchecked -cp ${CLASS_PATH} -d ${OUT_DIR} ${PROJECT_DIR}/*.java -printf "\n\n\nRunning Program...\n\n" -ORIGINAL_LOC=$(pwd) -cd $OUT_DIR -if java ${CUSTOM_PARAMS} -cp .:../lib/bin/ -XX:+UseZGC -Djava.library.path="${LIBRARY_PATH}" ${MAIN_CLASS} "$@"; then - ${ORIGINAL_LOC}/${LANGUAGE}/scripts/clean.sh - exit -fi -if java ${CUSTOM_PARAMS} -cp .:../lib/bin/ -XX:+UnlockExperimentalVMOptions -XX:+UseZGC -Djava.library.path="${LIBRARY_PATH}" ${MAIN_CLASS} "$@"; then - ${ORIGINAL_LOC}/${LANGUAGE}/scripts/clean.sh - exit -fi -java ${CUSTOM_PARAMS} -cp .:../lib/bin/ -XX:+PrintCommandLineFlags -Djava.library.path="${LIBRARY_PATH}" ${MAIN_CLASS} "$@" -${ORIGINAL_LOC}/${LANGUAGE}/scripts/clean.sh \ No newline at end of file diff --git a/Java/scripts/build2.sh b/Java/scripts/build2.sh deleted file mode 100644 index 53fe062..0000000 --- a/Java/scripts/build2.sh +++ /dev/null @@ -1,17 +0,0 @@ -#Builds and runs the project for Windows. -#Java -source ${LANGUAGE}/scripts/version_info -javac -source ${SOURCE_VERSION} -target ${TARGET_VERSION} -Xlint:unchecked -cp ${CLASS_PATH_WINDOWS} -d ${OUT_DIR} ${PROJECT_DIR}/*.java -printf "\n\n\nRunning Program...\n\n" -ORIGINAL_LOC=$(pwd) -cd $OUT_DIR -if java ${CUSTOM_PARAMS} -cp ".;../lib/bin/" -XX:+UseZGC "-Djava.library.path=${LIBRARY_PATH}" ${MAIN_CLASS} "$@"; then - ${ORIGINAL_LOC}/${LANGUAGE}/scripts/clean.sh - exit -fi -if java ${CUSTOM_PARAMS} -cp ".;../lib/bin/" -XX:+UnlockExperimentalVMOptions -XX:+UseZGC "-Djava.library.path=${LIBRARY_PATH}" ${MAIN_CLASS} "$@"; then - ${ORIGINAL_LOC}/${LANGUAGE}/scripts/clean.sh - exit -fi -java ${CUSTOM_PARAMS} -cp ".;../lib/bin/" -XX:+PrintCommandLineFlags "-Djava.library.path=${LIBRARY_PATH}" ${MAIN_CLASS} "$@" -${ORIGINAL_LOC}/${LANGUAGE}/scripts/clean.sh \ No newline at end of file diff --git a/Java/scripts/clean.sh b/Java/scripts/clean.sh deleted file mode 100755 index 0963522..0000000 --- a/Java/scripts/clean.sh +++ /dev/null @@ -1,4 +0,0 @@ -#Cleans up and removes unused files. -#Java -find -type f -name *.class -delete -find -type f -name manifest -delete \ No newline at end of file diff --git a/Java/scripts/commit.sh b/Java/scripts/commit.sh deleted file mode 100755 index 36b45b5..0000000 --- a/Java/scripts/commit.sh +++ /dev/null @@ -1,20 +0,0 @@ -#Adds a commit message and pushes project to github repository. -#Java -COMMIT_MESSAGE="$*" -FIRST_LINE=true -while IFS= read -r line -do -if [ "$FIRST_LINE" = true ]; then - COMMIT_MESSAGE+=" - -Co-authored-by: $line" -FIRST_LINE=false -else - COMMIT_MESSAGE+=" -Co-authored-by: $line" -fi -done < utils/.coauthors -git add -u -git add * -git commit -m "$COMMIT_MESSAGE" -git push \ No newline at end of file diff --git a/Java/scripts/filelist b/Java/scripts/filelist deleted file mode 100644 index 9e5004d..0000000 --- a/Java/scripts/filelist +++ /dev/null @@ -1,10 +0,0 @@ -build2.sh -build.sh -clean.sh -commit.sh -jar2.sh -jar.sh -release.sh -update.sh -version_info -zip.sh diff --git a/Java/scripts/jar.sh b/Java/scripts/jar.sh deleted file mode 100755 index 61d1759..0000000 --- a/Java/scripts/jar.sh +++ /dev/null @@ -1,17 +0,0 @@ -#Builds a runnable jar file using ${MAIN_CLASS} as an entry point and then runs the newly generated jar. -#Java -source ${LANGUAGE}/scripts/version_info -rm -Rf bin/* -javac -source ${SOURCE_VERSION} -target ${TARGET_VERSION} -Xlint:unchecked -cp ${CLASS_PATH} -d ${OUT_DIR} ${PROJECT_DIR}/${PROJECT_NAME}.java -printf "\n\n\nGenerating Manifest...\n\n" -touch manifest -echo "Main-Class: ${MAIN_CLASS}" > manifest -printf "\n\n\nCreating Jar...\n\n" -ORIGINAL_LOC=$(pwd) -cd ${OUT_DIR} -jar cfm ${PROJECT_NAME}.jar ${ORIGINAL_LOC}/manifest sig -jar uf ${PROJECT_NAME}.jar -C ../lib/bin/ . -printf "\n\n\nRunning Program...\n\n" -java ${CUSTOM_PARAMS} -cp .:../lib/bin -Djava.library.path="${LIBRARY_PATH}" -jar ${PROJECT_NAME}.jar "$@" -${ORIGINAL_LOC}/${LANGUAGE}/scripts/clean.sh -cd .. diff --git a/Java/scripts/jar2.sh b/Java/scripts/jar2.sh deleted file mode 100755 index 9167bb8..0000000 --- a/Java/scripts/jar2.sh +++ /dev/null @@ -1,17 +0,0 @@ -#Builds a runnable jar file using ${MAIN_CLASS} as an entry point and then runs the newly generated jar for Windows. -#Java -source ${LANGUAGE}/scripts/version_info -rm -Rf bin/* -javac -source ${SOURCE_VERSION} -target ${TARGET_VERSION} -Xlint:unchecked -cp ${CLASS_PATH_WINDOWS} -d ${OUT_DIR} ${PROJECT_DIR}/${PROJECT_NAME}.java -printf "\n\n\nGenerating Manifest...\n\n" -touch manifest -echo "Main-Class: ${MAIN_CLASS}" > manifest -printf "\n\n\nCreating Jar...\n\n" -ORIGINAL_LOC=$(pwd) -cd ${OUT_DIR} -jar cfm ${PROJECT_NAME}.jar ${ORIGINAL_LOC}/manifest sig -jar uf ${PROJECT_NAME}.jar -C ../lib/bin/ . -printf "\n\n\nRunning Program...\n\n" -java ${CUSTOM_PARAMS} -cp .;../lib/bin "-Djava.library.path=${LIBRARY_PATH}" -jar ${PROJECT_NAME}.jar "$@" -${ORIGINAL_LOC}/${LANGUAGE}/scripts/clean.sh -cd .. diff --git a/Java/scripts/md5 b/Java/scripts/md5 deleted file mode 100644 index b2c3eed..0000000 --- a/Java/scripts/md5 +++ /dev/null @@ -1,9 +0,0 @@ -build2.sh:b1c6b7c6b2eb19ba54be6824bda8805b - -build.sh:5df470d49036bf7565493739aeebeaa8 - -clean.sh:668a2f9b568c55f6a044a509315032f6 - -commit.sh:5e4448db9ad48e72ec3a1ff4f5763b41 - -jar2.sh:7977fc138ee5db798d08c34734f0be93 - -jar.sh:821d5a109324d405f05c35c4bb129375 - -release.sh:027178aa6da76180401a188d8f03af64 - -update.sh:3be721658983183efa395984acd96b03 - -zip.sh:273f5a83b80a8e54022d60514dfeec0a - diff --git a/Java/scripts/release.sh b/Java/scripts/release.sh deleted file mode 100644 index fca8c4b..0000000 --- a/Java/scripts/release.sh +++ /dev/null @@ -1,28 +0,0 @@ -#Use ./sig release to create a custom installer based on OS. -#Java -source ${LANGUAGE}/scripts/version_info -FILES=$(cat ${LANGUAGE}/scripts/.package.files) -if [ "$1" = "windows" ];then - echo "Creating a package for Windows..." - echo "Not implemented yet." -elif [ "$1" = "mac" ];then - echo "Creating a package for Mac..." - echo "Not implemented yet." -elif [ "$1" = "linux" ];then - echo "Creating a package for Linux..." - cd .. - mkdir -vp RabiCloneOut/in - for f in $FILES - do - cp -Rv --parents $PROJECT_NAME/$f RabiCloneOut/in - done - jpackage --verbose --input RabiCloneOut/in/RabiClone --main-jar bin/RabiClone.jar --main-class sig.RabiClone --type app-image --dest RabiCloneOut - cp -Rv RabiCloneOut/RabiClone/lib/app/* RabiCloneOut/RabiClone - jpackage --verbose --app-image RabiCloneOut/RabiClone --name RabiClone - rm -Rfv RabiCloneOut - cd RabiClone - echo "Done!" -else - echo "Usage: " - echo " ./sig release " -fi \ No newline at end of file diff --git a/Java/scripts/update.sh b/Java/scripts/update.sh deleted file mode 100755 index 517be05..0000000 --- a/Java/scripts/update.sh +++ /dev/null @@ -1,3 +0,0 @@ -#Pulls the latest version of the repository. -#Java -git pull \ No newline at end of file diff --git a/Java/scripts/version_info b/Java/scripts/version_info deleted file mode 100644 index 719f74f..0000000 --- a/Java/scripts/version_info +++ /dev/null @@ -1,3 +0,0 @@ -export SOURCE_VERSION="8" -export TARGET_VERSION="8" -export RELEASE_VERSION="0.0a" \ No newline at end of file diff --git a/Java/scripts/zip.sh b/Java/scripts/zip.sh deleted file mode 100644 index 4de5b1a..0000000 --- a/Java/scripts/zip.sh +++ /dev/null @@ -1,14 +0,0 @@ -#Create a zip folder containing all dependencies. For quick release. -#Java -source ${LANGUAGE}/scripts/version_info -TARGET_FILE="${PROJECT_NAME}_${RELEASE_VERSION}.zip" -FILES=$(cat ${LANGUAGE}/scripts/.package.files) -echo "Creating Package $TARGET_FILE..." -for f in $FILES -do - zip -ur $TARGET_FILE $f -done -echo "Complete!" -echo "" -echo "" -echo "" \ No newline at end of file diff --git a/README.md b/README.md index 0a3a1b9..cc55afb 100644 --- a/README.md +++ b/README.md @@ -1,33 +1,19 @@ -This repository contains general build scripts and pipelines for all languages that I incorporate in my projects. The goal is to provide an easy retrieval and update system for the project. Each script will be a shell script containing the following template: -```bash - #Short description about what I do - #Language[Folder] - # #The script's code goes in here. - # rm -Rf out/* - # javac -Xlint:unchecked -cp ${PROJECT_DIR}/.. -d ${OUT_DIR} ${PROJECT_DIR}/*.java - # printf "\n\n\nRunning Program...\n\n" - # cd $OUT_DIR - # java ${MAIN_CLASS} "$@" - # ../scripts/clean.sh - -``` -Each language will be in the following structure: -``` - - - -- - ---[script files.sh] -``` +This repository provides a template for starting a new C project using Sig's build system! Updates are automatically propogated. Run `./sig` for a list of commands and then use follow the instructions given to invoke them. Adjust variables as necessary in the `sig` command file. -The `sig` script will display by default any scripts in the `scripts` folder, therefore when creating a project, copy over the scripts folder of the desired language into your project then the `sig` script handles the rest appropriately. If your project requires multiple languages and build setups, then you can use the `sig2` command, which has an additional parameter to specify the language when running it. When setting up a multi-language setup, you'll just copy the entire folder to include the programming language itself. So a multi-language project structure may look something like this: -``` - -C - --scripts - ---build.sh - ---clean.sh - ---make.sh - -Java - --scripts - ---build.sh - ---clean.sh - ---jar.sh ``` +@sigonasr2 ➜ /workspaces/CProjectTemplate (main) $ ./sig +Dev build, no checks required. + + Usage: ./sig {args} + +==== Current Configuration ===================== + PROJECT_NAME CProjectTemplate + BUILD_OPTIONS -lncurses + LANGUAGE C +===================================================== + + Command List: + + build Compiles the entire program then runs it, producing an executable. + commit Adds a commit message and pushes project to github repository. +'`` \ No newline at end of file diff --git a/main.c b/main.c new file mode 100644 index 0000000..e4b3f6b --- /dev/null +++ b/main.c @@ -0,0 +1,5 @@ +#include + +int main(int argc,char**argv) { + printf("Hello World!"); +} \ No newline at end of file diff --git a/scripts/commit.sh b/scripts/commit.sh deleted file mode 100755 index 2040dfd..0000000 --- a/scripts/commit.sh +++ /dev/null @@ -1,32 +0,0 @@ -#Adds a commit message and pushes project to github repository. -# - -source utils/search.sh - -find . -type f -name md5 -delete -find . -type f -name filelist -delete - -#Generate a new hash for every sub-directory, which may require an update. -FILES=$(cat utils/.updateDirectories) -COMMIT_MESSAGE="$*" -FIRST_LINE=true -while IFS= read -r line -do -if [ "$FIRST_LINE" = true ]; then - COMMIT_MESSAGE+=" - -Co-authored-by: $line" -FIRST_LINE=false -else - COMMIT_MESSAGE+=" -Co-authored-by: $line" -fi -done < utils/.coauthors -for f in $FILES -do - search $f -done -git add -u -git add * -git commit -m "$COMMIT_MESSAGE" -git push \ No newline at end of file diff --git a/scripts/filelist b/scripts/filelist deleted file mode 100644 index d3dfe86..0000000 --- a/scripts/filelist +++ /dev/null @@ -1,2 +0,0 @@ -commit.sh -update.sh diff --git a/scripts/md5 b/scripts/md5 deleted file mode 100644 index d2a5b9b..0000000 --- a/scripts/md5 +++ /dev/null @@ -1,2 +0,0 @@ -commit.sh:ea122668a72b4445c10b6e9070f7bbd8 - -update.sh:7fda194f24fbd8779221066cbbc04b3f - diff --git a/scripts/update.sh b/scripts/update.sh deleted file mode 100755 index 26af9ea..0000000 --- a/scripts/update.sh +++ /dev/null @@ -1,3 +0,0 @@ -#Pulls the latest version of the repository. -# -git pull \ No newline at end of file diff --git a/sig b/sig index 5e2514a..c947af2 100755 --- a/sig +++ b/sig @@ -1,15 +1,9 @@ -export AUTO_UPDATE=true +export AUTO_UPDATE=false source utils/define.sh -define PROJECT_NAME "JavaProjectTemplate" -define PROJECT_DIR "src/sig" -define MAIN_CLASS "sig.${PROJECT_NAME}" -define OUT_DIR "bin" -define LIBRARY_PATH "../lib" -define CLASS_PATH "${PROJECT_DIR}/..:lib/bin" -define CLASS_PATH_WINDOWS "${PROJECT_DIR}/..;lib/bin" -define CUSTOM_PARAMS "" -define LANGUAGE "" +define PROJECT_NAME "CProjectTemplate" +define BUILD_OPTIONS "-lncurses" +define LANGUAGE "C" source utils/main.sh \ No newline at end of file