aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Allen <[email protected]>2016-05-22 23:24:16 -0500
committerMark Allen <[email protected]>2016-05-22 23:24:16 -0500
commit2546402aeeeef2906dd49ab2692d52b4c6c49ad1 (patch)
treeb98671926b65f1cfd6d2c76e584455707e864108
parent35e8de8178d1a343f0fb8ce252e6d56ec00fae6f (diff)
downloadkerl-2546402aeeeef2906dd49ab2692d52b4c6c49ad1.tar.gz
kerl-2546402aeeeef2906dd49ab2692d52b4c6c49ad1.tar.bz2
kerl-2546402aeeeef2906dd49ab2692d52b4c6c49ad1.zip
WIP: Inline patches
-rwxr-xr-xkerl115
1 files changed, 78 insertions, 37 deletions
diff --git a/kerl b/kerl
index 0f4a33b..44d6b28 100755
--- a/kerl
+++ b/kerl
@@ -378,23 +378,6 @@ show_logfile()
echo "Please see $2 for full details."
}
-download_patch()
-{
- TMPFILE=$(mktemp) || exit 1
- curl -sL "$OTP_GITHUB_URL/commit/$1" > "$TMPFILE"
- if [ $? -ne 0 ]; then
- echo "ERROR: Couldn't download patch $OTP_GITHUB_URL/commit/$1"
- rm "$TMPFILE"
- exit 1
- fi
- echo "$TMPFILE"
-}
-
-apply_patch()
-{
- patch -p1 < "$1" >> "$LOGFILE"
-}
-
maybe_patch()
{
# $1 = OS platform e.g., Darwin, etc
@@ -403,14 +386,11 @@ maybe_patch()
case "$1" in
Darwin)
maybe_patch_darwin "$2"
- maybe_patch_all "$2"
;;
SunOS)
maybe_patch_sunos "$2"
- maybe_patch_all "$2"
;;
*)
- maybe_patch_all "$2"
;;
esac
}
@@ -419,9 +399,7 @@ maybe_patch_darwin()
{
release=$(get_otp_version "$1")
if [ "$release" -le 14 ]; then
- filename=$(download_patch "687dfb57c61ef9a777f706b73b14da93aa3ea448.patch")
- apply_patch "$filename"
- rm "$filename"
+ apply_darwin_patch >> "$LOGFILE"
fi
}
@@ -429,19 +407,7 @@ maybe_patch_sunos()
{
release=$(get_otp_version "$1")
if [ "$release" -le 14 ]; then
- filename=$(download_patch "8e5ef86ee21cb6491287710606a7525f45cc50fc.patch")
- apply_patch "$filename"
- rm "$filename"
- fi
-}
-
-maybe_patch_all()
-{
- release=$(get_otp_version "$1")
- if [ "$release" -le 16 ]; then
- filename=$(download_patch "21ca6d3a137034f19862db769a5b7f1c5528dbc4.patch")
- apply_patch "$filename"
- rm "$filename"
+ apply_solaris_networking_patch >> "$LOGFILE"
fi
}
@@ -551,7 +517,7 @@ _do_build()
fi
done
fi
- ./otp_build boot -a $KERL_CONFIGURE_OPTIONS > "$LOGFILE" 2>&1
+ ./otp_build boot -a $KERL_CONFIGURE_OPTIONS >> "$LOGFILE" 2>&1
if [ $? -ne 0 ]; then
show_logfile "Build failed." "$LOGFILE"
list_remove builds "$1 $2"
@@ -1078,6 +1044,81 @@ tarball_download()
echo "Checksum verified ($SUM)"
}
+apply_solaris_networking_patch()
+{
+ patch -p1 <<_END_PATCH
+--- otp-a/erts/emulator/drivers/common/inet_drv.c
++++ otp-b/erts/emulator/drivers/common/inet_drv.c
+@@ -4166,16 +4166,7 @@
+ break;
+
+ case INET_IFOPT_HWADDR: {
+-#ifdef SIOCGIFHWADDR
+- if (ioctl(desc->s, SIOCGIFHWADDR, (char *)&ifreq) < 0)
+- break;
+- buf_check(sptr, s_end, 1+2+IFHWADDRLEN);
+- *sptr++ = INET_IFOPT_HWADDR;
+- put_int16(IFHWADDRLEN, sptr); sptr += 2;
+- /* raw memcpy (fix include autoconf later) */
+- sys_memcpy(sptr, (char*)(&ifreq.ifr_hwaddr.sa_data), IFHWADDRLEN);
+- sptr += IFHWADDRLEN;
+-#elif defined(SIOCGENADDR)
++#if defined(SIOCGENADDR)
+ if (ioctl(desc->s, SIOCGENADDR, (char *)&ifreq) < 0)
+ break;
+ buf_check(sptr, s_end, 1+2+sizeof(ifreq.ifr_enaddr));
+_END_PATCH
+}
+
+apply_darwin_patch()
+{
+ patch -p0 <<_END_PATCH
+--- erts/emulator/beam/beam_bp.c.orig 2011-10-03 13:12:07.000000000 -0500
++++ erts/emulator/beam/beam_bp.c 2013-10-04 13:42:03.000000000 -0500
+@@ -496,7 +496,8 @@
+ }
+
+ /* bp_hash */
+-ERTS_INLINE Uint bp_sched2ix() {
++#ifndef ERTS_DO_INCL_GLB_INLINE_FUNC_DEF
++ERTS_GLB_INLINE Uint bp_sched2ix() {
+ #ifdef ERTS_SMP
+ ErtsSchedulerData *esdp;
+ esdp = erts_get_scheduler_data();
+@@ -505,6 +506,7 @@
+ return 0;
+ #endif
+ }
++#endif
+ static void bp_hash_init(bp_time_hash_t *hash, Uint n) {
+ Uint size = sizeof(bp_data_time_item_t)*n;
+ Uint i;
+--- erts/emulator/beam/beam_bp.h.orig 2011-10-03 13:12:07.000000000 -0500
++++ erts/emulator/beam/beam_bp.h 2013-10-04 13:42:08.000000000 -0500
+@@ -144,7 +144,19 @@
+ #define ErtsSmpBPUnlock(BDC)
+ #endif
+
+-ERTS_INLINE Uint bp_sched2ix(void);
++ERTS_GLB_INLINE Uint bp_sched2ix(void);
++
++#ifdef ERTS_DO_INCL_GLB_INLINE_FUNC_DEF
++ERTS_GLB_INLINE Uint bp_sched2ix() {
++#ifdef ERTS_SMP
++ ErtsSchedulerData *esdp;
++ esdp = erts_get_scheduler_data();
++ return esdp->no - 1;
++#else
++ return 0;
++#endif
++}
++#endif
+
+ #ifdef ERTS_SMP
+ #define bp_sched2ix_proc(p) ((p)->scheduler_data->no - 1)
+_END_PATCH
+}
+
case "$1" in
build)
if [ "$2" = "git" ]; then