diff options
author | LAN-TW <lantw44@gmail.com> | 2012-10-27 20:01:48 +0800 |
---|---|---|
committer | LAN-TW <lantw44@gmail.com> | 2012-10-27 20:01:48 +0800 |
commit | 0869aeeba4c0cecd5279891666fe068ed87d5ccc (patch) | |
tree | e4a374e86d07b2f6f743e965f9af1f89350f282f | |
parent | c620f6718725938c31d320b7719fc1bb8ec3368c (diff) | |
download | sctjudge-0869aeeba4c0cecd5279891666fe068ed87d5ccc.tar.gz sctjudge-0869aeeba4c0cecd5279891666fe068ed87d5ccc.tar.zst sctjudge-0869aeeba4c0cecd5279891666fe068ed87d5ccc.zip |
現在可以藉由 configure 來修改 Linux proc 檔案系統位置了
這個修改主要是為了配合 FreeBSD 的 linprocfs 而做的,因為一般來說 FreeBSD 的
linprocfs 會掛載在 /compat/linux/proc 而不在 /proc。
同時也修改了 RPM spec 檔案,現在可以在版本號裡加上 rc 標記了!
-rw-r--r-- | configure.ac | 19 | ||||
-rw-r--r-- | sctjudge.spec.in | 8 | ||||
-rw-r--r-- | src/config2.h | 3 | ||||
-rw-r--r-- | src/main.c | 9 |
4 files changed, 32 insertions, 7 deletions
diff --git a/configure.ac b/configure.ac index 44f4b18..232a5b5 100644 --- a/configure.ac +++ b/configure.ac @@ -8,6 +8,7 @@ AC_CONFIG_SRCDIR([src/main.c]) AC_CONFIG_HEADERS([src/config.h]) releasedate="2012-XX-XX" +rpmversion="1.0" # Checks for programs. AC_PROG_CC @@ -58,6 +59,19 @@ test x"${opt_cap}" = xyes && \ AC_DEFINE([HAVE_CONF_CAP], [1], [Linux Capabilities]) +# 可以設定 proc filesystem 在哪裡 +AC_ARG_WITH([proc], + AS_HELP_STRING([--with-proc=PROC], + [set the location of your Linux proc file system]), + [with_proc=$withval], [with_proc=/proc]) + +if test x"${opt_procmon}" = xyes; then \ + AC_CHECK_FILES([${with_proc}/stat ${with_proc}/$$/stat ${with_proc}/$$/statm ${with_proc}/$$/status], + [AC_DEFINE_UNQUOTED([PROC_PATH], ["${with_proc}"], [Location of Linux proc file system])], + [AC_MSG_ERROR([Linux proc file system support is incomplete])]) +fi + + # Checks for libraries. checkliblist="pthread_create pthread_exit pthread_cancel pthread_join pthread_attr_init pthread_attr_destroy pthread_attr_setdetachstate pthread_mutex_init pthread_mutex_destroy pthread_mutex_lock pthread_mutex_unlock pthread_setcancelstate pthread_setcanceltype" @@ -98,6 +112,7 @@ AM_CONDITIONAL([USING_SETCAP], [test x"${opt_cap}" = xyes]) # 寫入版本資訊 AC_SUBST([PROGRAM_NAME], [AC_PACKAGE_NAME]) AC_SUBST([PROGRAM_VERSION], [AC_PACKAGE_VERSION]) +AC_SUBST([PROGRAM_RPMVERSION], $rpmversion) AC_SUBST([PROGRAM_DATE], $releasedate) # Checks for header files. @@ -141,4 +156,8 @@ echo "-------------------------------------------------------------" | tee -a "$ echo "Compiling and Linking Options:" | tee -a "$confmsgsave" echo "(1) Debugging information ........................... $opt_debug" | tee -a "$confmsgsave" echo "(2) Statically linked executable .................... $opt_static" | tee -a "$confmsgsave" +echo "-------------------------------------------------------------" | tee -a "$confmsgsave" +echo "Strings:" | tee -a "$confmsgsave" +echo "(1) Linux proc filesystem path ...................... $with_proc" | tee -a "$confmsgsave" +echo "(2) Data sink path .................................. $with_null" | tee -a "$confmsgsave" echo "The above messages has been written to $confmsgsave" diff --git a/sctjudge.spec.in b/sctjudge.spec.in index ca8e370..3886952 100644 --- a/sctjudge.spec.in +++ b/sctjudge.spec.in @@ -1,12 +1,12 @@ Name: @PROGRAM_NAME@ -Version: @PROGRAM_VERSION@ +Version: @PROGRAM_RPMVERSION@ Release: 1%{?dist} Summary: Simple common test judge program Group: Applications -License: 3-clause BSD license +License: BSD URL: http://www.tfcis.org/~lantw44/programs.html -Source0: sctjudge-%{version}.tar.gz +Source0: @PROGRAM_NAME@-@PROGRAM_VERSION@.tar.gz BuildRequires: gcc glibc-devel libcap libcap-devel Requires: glibc libcap @@ -15,7 +15,7 @@ Requires: glibc libcap 一個簡易的程式設計題目評測程式 %prep -%setup -q +%setup -q -n @PROGRAM_NAME@-@PROGRAM_VERSION@ %build diff --git a/src/config2.h b/src/config2.h index 793fb18..822ebdb 100644 --- a/src/config2.h +++ b/src/config2.h @@ -8,9 +8,6 @@ /* XXX 這個看能不能用 GNU autotool 取代,我可不確定 /dev/null 永遠存在!*/ #define NULL_DEVICE "/dev/null" -/* TODO 定義 Linux proc 檔案系統在哪裡,之後會用 GNU autotool 取代 */ -#define PROC_PATH "/proc" - /* sctjudge 這個程式的 exit status */ #define SCTEXIT_SUCCESS 0 /* 當然就是正常結束 */ #define SCTEXIT_SYNTAX 1 /* 解析階段:命令列語法錯誤 */ @@ -189,6 +189,15 @@ int main(int argc, char* argv[]){ "自動轉換使用者或群組名稱成 UID 或 GID " "(自動偵測)\n" ); + putchar('\n'); + printf("編譯時指定的參數列表:\n" +#ifdef PROC_PATH + " * Linux 的 proc 檔案系統路徑:" + PROC_PATH + " (--with-proc)" +#endif + "\n" + ); exit(SCTEXIT_SUCCESS); }else if(!strcmp(&argv[i][1], "v") || !strcmp(&argv[i][1], "verbose")){ |