summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Freeman <saurik@saurik.com>2008-06-16 20:04:36 +0000
committerJay Freeman <saurik@saurik.com>2008-06-16 20:04:36 +0000
commitda867033916f9a1c940ca49813df5bcbdc202059 (patch)
tree00375ceb42f4cf036efcc63fc1d3e9659dd854cd
parentcc5f9882aa93d30ad944b390a4a20bf21478ef42 (diff)
Added .ar and .elc determinism.
git-svn-id: http://svn.telesphoreo.org/trunk@317 514c082c-b64e-11dc-b46d-3d985efe055d
-rwxr-xr-xmake.sh18
-rw-r--r--util/arid.cpp29
2 files changed, 47 insertions, 0 deletions
diff --git a/make.sh b/make.sh
index de061f078..c95161282 100755
--- a/make.sh
+++ b/make.sh
@@ -13,6 +13,10 @@ export PKG_BASE=$(realpath "$(dirname "$0")")
. "${PKG_BASE}/helper.sh"
+if [[ ! -x ${PKG_BASE}/util/arid || ${PKG_BASE}/util/arid -ot ${PKG_BASE}/util/arid.cpp ]]; then
+ g++ -I ~/menes -o "${PKG_BASE}"/util/arid{,.cpp}
+fi
+
if [[ ! -x ${PKG_BASE}/util/ldid || ${PKG_BASE}/util/ldid -ot ${PKG_BASE}/util/ldid.cpp ]]; then
g++ -I ~/menes -o "${PKG_BASE}"/util/ldid{,.cpp} -x c "${PKG_BASE}"/util/{lookup2,sha1}.c
fi
@@ -105,6 +109,7 @@ export -f pkg:setup
function pkg:configure() {
PKG_CONFIG="$(realpath "${PKG_BASE}/util/pkg-config.sh")" \
ac_cv_prog_cc_g=no \
+ ac_cv_prog_cxx_g=no \
"${PKG_CONF}" \
--build=x86_64-unknown-linux-gnu \
--host="${PKG_TARG}" \
@@ -179,5 +184,18 @@ if [[ -e "${PKG_BASE}/arch/${PKG_ARCH}/strip" ]]; then
. "${PKG_BASE}/arch/${PKG_ARCH}/strip"
fi
+find "${PKG_DEST}" -type f -name '*.elc' -print0 | while read -r -d $'\0' bin; do
+ sed -i -e '
+ s/^;;; Compiled by .*$//
+ s/^;;; from file .*$//
+ s/^;;; in Emacs version .*$//
+ s/^;;; with .*$//
+ ' "${bin}"
+done
+
+find "${PKG_DEST}" -type f -name '*.a' -print0 | while read -r -d $'\0' bin; do
+ "${PKG_BASE}/util/arid" "${bin}"
+done
+
cp -a "${PKG_DATA}/_metadata/version" "${PKG_STAT}/data-ver"
echo "${PKG_HASH}" >"${PKG_STAT}/data-md5"
diff --git a/util/arid.cpp b/util/arid.cpp
new file mode 100644
index 000000000..ab2bccb60
--- /dev/null
+++ b/util/arid.cpp
@@ -0,0 +1,29 @@
+#include <iostream>
+#include "minimal/mapping.h"
+
+struct ar_hdr {
+ char ar_name[16];
+ char ar_date[12];
+ char ar_uid[6];
+ char ar_gid[6];
+ char ar_mode[8];
+ char ar_size[10];
+#define ARFMAG "`\n"
+ char ar_fmag[2];
+};
+
+int main(int argc, char *argv[]) {
+ size_t size;
+ _assert(argc == 2);
+ uint8_t *data = reinterpret_cast<uint8_t *>(map(argv[1], 0, _not(size_t), &size, false));
+ data += 8;
+ uint8_t *end = data + size;
+ while (end - data >= sizeof(struct ar_hdr)) {
+ struct ar_hdr *head = reinterpret_cast<struct ar_hdr *>(data);
+ memset(head->ar_date + 1, ' ', sizeof(head->ar_date) - 1);
+ head->ar_date[0] = '0';
+ size_t length = strtoul(head->ar_size, NULL, 10);
+ data += length + sizeof(struct ar_hdr);
+ }
+ return 0;
+}