Hi,

I'm trying to build skalibs on OS X (10.8.4, GNU bash, version 3.2.48(1)-release
(x86_64-apple-darwin12)).

I've had to apply the following two patches:

The first changes /bin/sh to /bin/bash so that "echo -n" works as intended
(with /bin/sh, the "-n" is not interpreted as an argument).

It also changes "exec ./compile tryclockrt.c" to "./compile tryclockrt.c; :".
Without that change, the build fails:

  exec ./compile tryclockrt.c
  tryclockrt.c: In function 'main':
tryclockrt.c:9:3: warning: implicit declaration of function 'clock_gettime'
  [-Wimplicit-function-declaration]
   if (clock_gettime(CLOCK_REALTIME, &ts) < 0) return 111 ;
   ^
tryclockrt.c:9:21: error: 'CLOCK_REALTIME' undeclared (first use in this
  function)
   if (clock_gettime(CLOCK_REALTIME, &ts) < 0) return 111 ;
   ^
tryclockrt.c:9:21: note: each undeclared identifier is reported only once
  for each function it appears in
  make[1]: *** [hasclockrt.h] Error 1

The second patch changes some gcc and ld args for Mac OS X:

  $ gcc --version
i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build
  5658) (LLVM build 2336.11.00)
  $ ld -v
  @(#)PROGRAM:ld PROJECT:ld64-136
  configured to support archs: armv6 armv7 armv7s i386 x86_64
  LTO support using: LLVM version 3.2svn, from Apple Clang 4.2 (build
  425.0.28)

(And FYI, once I've got skalibs, execline and s6 seem to build just fine on OS X,
at least statically linked versions).

--
Patrick Mahoney
--- a/src/sys/make-compile
+++ b/src/sys/make-compile
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 cc="`head -n 1 conf-cc`"
 cat warn-auto.sh
--- a/src/sys/make-compilefordynlib
+++ b/src/sys/make-compilefordynlib
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 cc="`head -n 1 conf-cc`"
 cat warn-auto.sh
--- a/src/sys/make-load
+++ b/src/sys/make-load
@@ -1,4 +1,4 @@
-#!/bin/sh -e
+#!/bin/bash -e
 
 ld="`head -n 1 conf-ld`"
 strip="`head -n 1 conf-stripbins`"
--- a/src/sys/make-makelib
+++ b/src/sys/make-makelib
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 cat warn-auto.sh
 echo 'main="$1"; shift'
--- a/src/sysdeps/Makefile
+++ b/src/sysdeps/Makefile
@@ -218,7 +218,7 @@ hasclockmon.h: choose compile load hasclockmon.h1 
hasclockmon.h2 rt.lib
        exec ./choose cl tryclockmon hasclockmon.h1 hasclockmon.h2 `cat rt.lib` 
> hasclockmon.h
 
 hasclockrt.h: compile load tryclockrt.c hasclockrt.h1 hasclockrt.h2
-       exec ./compile tryclockrt.c
+       ./compile tryclockrt.c; :
        if ./load tryclockrt 2>/dev/null ; then cat hasclockrt.h2 > 
hasclockrt.h ; : > rt.lib ; \
        elif ./load tryclockrt -lrt 2>/dev/null ; then cat hasclockrt.h2 > 
hasclockrt.h ; echo -lrt > rt.lib ; \
        else cat hasclockrt.h1 > hasclockrt.h ; : > rt.lib ; \
--- a/src/sys/make-load
+++ b/src/sys/make-load
@@ -7,7 +7,7 @@ test -n "$strip" || strip="echo Not stripping"
 cat warn-auto.sh
 echo 'main="$1" ; shift'
 echo -n "$ld "
-test -f flag-allstatic || { echo -n '-Wl,--allow-shlib-undefined ' ; ./stupid 
< path-library.so | while read dir ; do echo -n "-L $dir " ; done ; }
+test -f flag-allstatic || { echo -n '-Wl,-undefined,error ' ; ./stupid < 
path-library.so | while read dir ; do echo -n "-L $dir " ; done ; }
 ./stupid < path-library | while read dir ; do echo -n "-L $dir " ; done
 echo '-L . -o "$main" "$main".o ${1+"$@"}'
 echo exec "$strip" '"$main"'
--- a/src/sys/make-makedynlib
+++ b/src/sys/make-makedynlib
@@ -3,7 +3,7 @@
 ld="`head -n 1 conf-dynld`"
 cat warn-auto.sh
 echo 'main="$1" ; version="$2" ; shift ; shift ; major=`echo "$version" | cut 
-f1 -d.` ; minor=`echo "$version" | cut -f2 -d.`'
-echo "$ld" '-fPIC -shared -Wl,-h"$main.$major" -o "$main.$version" ${1+"$@"}'
+echo "$ld" '-fPIC -shared -Wl,-install_name,"$main.$major" -o "$main.$version" 
${1+"$@"}'
 echo 'rm -f "$main.$major.$minor"{new} "$main.$major"{new} "$main"{new}'
 echo 'test "$major.$minor" != "$version" && { ln -s "$main.$version" 
"$main.$major.$minor"{new} ; mv -f "$main.$major.$minor"{new} 
"$main.$major.$minor" ; } || true'
 echo 'ln -s "$main.$major.$minor" "$main.$major"{new}'

Reply via email to