Browse files

Auto-generate repo_schema and compiler_id on build

  • Loading branch information...
1 parent 6e02d70 commit 8cc00a93fa74286797ef790e51c8f9c4e9a1ffef @sgolemon sgolemon committed Oct 3, 2012
Showing with 40 additions and 34 deletions.
  1. +1 −0 .gitignore
  2. +5 −0 bin/generate_compiler_id.sh
  3. +17 −0 bin/generate_repo_schema.sh
  4. +17 −2 src/CMakeLists.txt
  5. +0 −16 src/runtime/base/compiler_id.h
  6. +0 −16 src/runtime/vm/repo_schema.h
View
1 .gitignore
@@ -39,6 +39,7 @@ hphp.log
/src/runtime/tmp/run.sh
/src/runtime/tmp/libtest.so
/src/runtime/vm/repo_schema.h
+/src/runtime/base/compiler_id.h
/src/hphpi/gen
/src/hphpi/hphpi
View
5 bin/generate_compiler_id.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+cd ${HPHP_HOME}
+COMPILER_ID=`git describe --all --long --abbrev=40 --always`
+echo "#define COMPILER_ID \"${COMPILER_ID}\"" > src/runtime/base/compiler_id.h
View
17 bin/generate_repo_schema.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+cd ${HPHP_HOME}
+# Generate src/runtime/vm/repo_schema.h
+REPO_TREE=`git log -n1 --pretty=format:%T HEAD`
+REPO_MODS=`git diff --name-only HEAD`
+if [ "${REPO_MODS}" != "" ]; then
+ REPO_TREE=`
+ export GIT_INDEX_FILE=.git-index-$$$$;
+ git read-tree ${REPO_TREE};
+ git update-index --add --remove ${REPO_MODS};
+ git write-tree;
+ rm -f $GIT_INDEX_FILE`
+fi
+HHVM_REPO_SCHEMA=`git ls-tree --full-tree ${REPO_TREE} src/ | grep -v src/test | git hash-object --stdin`
+echo "#define REPO_SCHEMA \"${HHVM_REPO_SCHEMA}\"" > src/runtime/vm/repo_schema.h
+
View
19 src/CMakeLists.txt
@@ -25,7 +25,6 @@ else()
SET(USE_HHVM FALSE)
endif()
-
if (USE_HHVM)
ADD_DEFINITIONS("-DHHVM -DHHVM_BINARY=1 -DHHVM_PATH=\\\"${HPHP_HOME}/src/hhvm/hhvm\\\"")
else()
@@ -149,7 +148,23 @@ foreach (CXX_FILE ${CXX_SOURCES})
endif()
endforeach()
-ADD_LIBRARY(hphp_runtime_static STATIC ${CXX_SOURCES} ${C_SOURCES})
+add_custom_command(
+ OUTPUT runtime/base/compiler_id.h
+ COMMAND bin/generate_compiler_id.sh
+ DEPENDS ${CXX_SOURCES} ${C_SOURCES}
+ WORKING_DIRECTORY ${HPHP_HOME}
+ COMMENT "Generating Compiler ID"
+ VERBATIM)
+
+add_custom_command(
+ OUTPUT runtime/vm/repo_schema.h
+ COMMAND bin/generate_repo_schema.sh
+ DEPENDS ${CXX_SOURCES} ${C_SOURCES}
+ WORKING_DIRECTORY ${HPHP_HOME}
+ COMMENT "Generating Repo Schema ID"
+ VERBATIM)
+
+ADD_LIBRARY(hphp_runtime_static STATIC runtime/vm/repo_schema.h runtime/base/compiler_id.h ${CXX_SOURCES} ${C_SOURCES})
#ADD_LIBRARY(hphp_runtime SHARED ${C_SOURCES} ${CXX_SOURCES})
SET_TARGET_PROPERTIES(hphp_runtime_static PROPERTIES OUTPUT_NAME "hphp_runtime")
SET_TARGET_PROPERTIES(hphp_runtime_static PROPERTIES PREFIX "lib")
View
16 src/runtime/base/compiler_id.h
@@ -1,16 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | HipHop for PHP |
- +----------------------------------------------------------------------+
- | Copyright (c) 2010- Facebook, Inc. (http://www.facebook.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
-*/
-#define COMPILER_ID "heads/non-jemalloc-0-gf706b58bf91977c76047105cfd29b8ac01e8b367"
View
16 src/runtime/vm/repo_schema.h
@@ -1,16 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | HipHop for PHP |
- +----------------------------------------------------------------------+
- | Copyright (c) 2010- Facebook, Inc. (http://www.facebook.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
-*/
-#define REPO_SCHEMA "b80e9eee242ceb671aadb816889156f78102537c"

0 comments on commit 8cc00a9

Please sign in to comment.