Skip to content

Instantly share code, notes, and snippets.

@kimuraw
kimuraw / ruby2.4.0.diff
Created December 25, 2016 14:09
ruby-2.4.0: `make` and `make test` passed on OS X 10.6 Snow Leopard (i386)
diff --git a/ext/-test-/memory_status/memory_status.c b/ext/-test-/memory_status/memory_status.c
index 80e2648..8466609 100644
--- a/ext/-test-/memory_status/memory_status.c
+++ b/ext/-test-/memory_status/memory_status.c
@@ -18,11 +18,11 @@ read_status(VALUE self)
VALUE rss;
kern_return_t error;
mach_msg_type_number_t out_count;
- mach_task_basic_info_data_t taskinfo;
+ task_basic_info_data_t taskinfo;
@kimuraw
kimuraw / rb22-Portfile-samples.md
Created May 29, 2015 14:09
MacPorts' rb22-* Portfile samples

MacPorts' rb22-* Portfile samples

see MacPorts Guide to know how to writing Portfile(s).

  1. Simple Gem

install bundler with ruby-2.2 rubygems.

CC = /usr/bin/clang
LD = ld
LDSHARED = /usr/bin/clang -dynamiclib
CFLAGS = -pipe -Os -arch x86_64 -fno-common -arch x86_64
XCFLAGS = -include ruby/config.h -include ruby/missing.h -D_FORTIFY_SOURCE=2 -fstack-protector -fno-strict-overflow -fvisibility=hidden -DRUBY_EXPORT
CPPFLAGS = -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -I/opt/local/include -I. -I.ext/include/x86_64-darwin13 -I./include -I.
DLDFLAGS = -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -L/opt/local/lib -install_name /opt/local/lib/libruby.2.0.0.dylib -current_version 2.0.0 -compatibility_version 2.0.0 -fstack-protector -Wl,-u,_objc_msgSend -fstack-protector -Wl,-u,_objc_msgSend -arch x86_64
SOLIBS =
./miniruby -I./lib -I. -I.ext/common ./tool/runruby.rb --extout=.ext -- --disable-gems "./test/runner.rb" --ruby="./miniruby -I./lib -I. -I.ext/common ./tool/runruby.rb --extout=.ext -- --disable-gems" -j4
Run options: "--ruby=./miniruby -I./lib -I. -I.ext/comm
@kimuraw
kimuraw / TemplateInfo.plist
Last active December 16, 2015 03:49
a sample of "InjectionTargets" of Xcode4 project template
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Kind</key>
<string>Xcode.Xcode3.ProjectTemplateUnitKind</string>
<key>Identifier</key>
<!-- Specify an unique identifier -->
<!-- 固有の識別子を指定します -->
<string>jp.nifty.i.kimuraw.dt.unit.AddDebugLog</string>
@kimuraw
kimuraw / gist:5068437
Last active December 14, 2015 09:58
Portfile style of rb-*|rb19-* port (MacPorts)

numbers of ruby.setup target:

% svn co https://svn.macports.org/repository/macports/trunk/dports/ruby
   :
Checked out revision 103576.
% cd ruby
% ack -a -G Portfile -h ruby\.setup | expand | sed -e 's/  */ /g' -e 's/{[^}]*}/{}/g' |
      cut -f 4 -d \ | cut -f 1 -d \: | sort | uniq -c 
  33 basic_install.rb

7 copy_install

@kimuraw
kimuraw / mongo-220-sm.diff
Created September 22, 2012 06:41
A patch for mongo-2.2.0 to fix build error with --use-system-sm
diff --git a/src/mongo/SConscript b/src/mongo/SConscript
index 06022a1..e1dd08f 100644
--- a/src/mongo/SConscript
+++ b/src/mongo/SConscript
@@ -175,7 +175,7 @@ env.CppUnitTest('bson_template_evaluator_test', ['scripting/bson_template_evalua
if usesm:
env.StaticLibrary('scripting', scripting_common_files + ['scripting/engine_spidermonkey.cpp'],
- LIBDEPS=['$BUILD_DIR/third_party/js-1.7/js', 'bson_template_evaluator'])
+ LIBDEPS=['$BUILD_DIR/third_party/shim_spidermonkey', 'bson_template_evaluator'])
@kimuraw
kimuraw / clang31onMountainLion.markdown
Created August 8, 2012 14:29
clang-3.1 or later (trunk) cannot generate an execute file

On Mac OS X 10.8 Mountain Lion, clang-3.1 does not work.

clang-3.1 (MacPorts)

% cat a.c
int main() {
return 0;
}
% clang-mp-3.1 --version     # MacPorts port:clang-3.1

clang version 3.1 (branches/release_31)

@kimuraw
kimuraw / patch-misc.c.diff
Created July 31, 2012 12:51
Fix crash boehmgc-7.2c on Mac OS X 10.8 Mountain Lion
--- misc.c.orig 2012-07-31 21:33:45.000000000 +0900
+++ misc.c 2012-07-31 21:34:09.000000000 +0900
@@ -283,7 +283,7 @@
/* not static because it could also be errorneously defined in .S */
/* file, so this error would be caught by the linker. */
/*ARGSUSED*/
- void * GC_clear_stack_inner(void *arg, ptr_t limit)
+ void * GC_clear_stack_inner(void *arg, volatile ptr_t limit)
{
word dummy[CLEAR_SIZE];
@kimuraw
kimuraw / patch-port-ruby-clang.diff
Created July 21, 2012 08:19
MacPorts port:ruby (ruby-1.8.7-p370) supports clang. requires Xcode 4.2 or later.
Index: files/patch-configure.diff
===================================================================
--- files/patch-configure.diff (revision 0)
+++ files/patch-configure.diff (working copy)
@@ -0,0 +1,19 @@
+--- configure.orig 2012-06-29 22:18:24.000000000 +0900
++++ configure 2012-07-21 16:32:51.000000000 +0900
+@@ -2722,6 +2722,7 @@
+
+ case $target_cpu in
@kimuraw
kimuraw / ruby187-numeric.c.diff
Created July 12, 2012 13:57
fix: ruby-1.8.7 built with clang "-Os". bignum does not pass sample/test.rb.
Index: numeric.c
===================================================================
--- numeric.c (revision 36354)
+++ numeric.c (working copy)
@@ -2161,7 +2161,7 @@
VALUE x, y;
{
if (FIXNUM_P(y)) {
-#ifdef __HP_cc
+#if defined(__HP_cc) || defined(__clang__)