Skip to content

Commit 300b9d9

Browse files
authored
OS X Support
2 parents 4f32df0 + dff64b7 commit 300b9d9

File tree

9 files changed

+547
-35
lines changed

9 files changed

+547
-35
lines changed

.travis.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# While Travis Support has been implemented for OSX, it does not fully build
2+
# due to the build time limit and the vast ammount of warnings generated
3+
4+
os:
5+
- osx
6+
osx_image: xcode7.3
7+
sudo: required
8+
language: node_js
9+
node_js:
10+
- "6.2.2"
11+
before_install:
12+
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then hdiutil create -type SPARSE -fs 'Case-sensitive Journaled HFS+' -size 10g -volname build ../build.dmg ; fi
13+
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then hdiutil attach ../build.dmg.sparseimage ; fi
14+
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then cp -r $TRAVIS_BUILD_DIR/* /Volumes/build ; fi
15+
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then cd /Volumes/build ; fi
16+
install:
17+
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install binutils ; fi
18+
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install gnu-sed --with-default-names ; fi
19+
script:
20+
- npm install

install-dependencies

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env bash
2+
3+
set +h
4+
5+
#
6+
# Applies OSX "dependencies" needed to compile the linux kernel
7+
#
8+
9+
if [[ $(uname -s) = "Darwin" ]]; then
10+
command -v port >/dev/null ||
11+
(
12+
echo "MacPorts is not installed" &&
13+
echo "Please visit https://www.macports.org/ for more information" &&
14+
exit 40
15+
)
16+
17+
port -q install gsed || exit $?
18+
ln -s /opt/local/bin/gsed /usr/local/bin/sed || exit $?
19+
20+
port -q install binutils || exit $?
21+
ln -s /opt/local/bin/gstrip /usr/local/bin/strip || exit $?
22+
fi

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@
5151
"dependencies": {
5252
"download-manager": "^0.0.20",
5353
"fs-extra": "^0.30.0",
54-
"prebuild-install": "1.0.2"
54+
"prebuild-install": "1.0.2",
55+
"async": "^2.0.0-rc.6"
5556
},
5657
"devDependencies": {
5758
"prebuild": "^4.2.2"

patches/linux/LICENSE

Lines changed: 340 additions & 0 deletions
Large diffs are not rendered by default.

patches/linux/linux-4.6.diff

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
--- Makefile
2+
+++ Makefile
3+
@@ -305,6 +305,11 @@
4+
-Wno-missing-field-initializers -fno-delete-null-pointer-checks
5+
endif
6+
7+
+ifeq ($(shell uname), Darwin)
8+
+HOSTCFLAGS += -I../glibc
9+
+HOSTCXXFLAGS += -I../glibc
10+
+endif
11+
+
12+
# Decide whether to build built-in, modular, or both.
13+
# Normally, just do built-in.
14+

scripts/BigRedButton

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ source scripts/adjustEnvVars.sh
88
#
99

1010
PRODUCTS=(bin lib libexec share *-nodeos-linux-musl)
11-
PREBUILD=prebuilds/linux-$NODE_ARCH.tar.gz
11+
PREBUILD=prebuilds/$KERNEL_NAME-$NODE_ARCH.tar.gz
1212

1313

1414
# Clean products previously to create them

scripts/adjustEnvVars.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ RED="\e[31m"
44
GRN="\e[32m"
55
WHT="\e[37m"
66
CLR="\e[0m"
7+
NWL="\n"
78

89
# Platform aliases
910
case $PLATFORM in
@@ -144,15 +145,15 @@ OBJECTS=`pwd`/build/$CPU
144145
MAKE1="make ${SILENT:=--silent LIBTOOLFLAGS=--silent V=}"
145146
MAKE="$MAKE1 --jobs=$JOBS"
146147

148+
KERNEL_NAME=$(uname -s | tr '[:upper:]' '[:lower:]')
147149

148150
function rmStep(){
149151
rm -rf "$@"
150-
rmdir -p --ignore-fail-on-non-empty `dirname "$@"`
151152
}
152153

153154
# Clean object dir and return the input error
154155
function err(){
155-
echo -e "${RED}Error compiling '${OBJ_DIR}'${CLR}"
156+
printf "${RED}Error compiling '${OBJ_DIR}'${CLR}${NWL}"
156157
rmStep $OBJ_DIR
157158
exit $1
158159
}

scripts/build

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ SRC_DIR=$DEPS/linux
4949
STEP_DIR=$KERNEL_HEADERS
5050

5151
if [[ ! -d $STEP_DIR ]]; then
52-
echo -e "${WHT}Extracting Linux headers${CLR}"
52+
printf "${WHT}Extracting Linux headers${CLR}${NWL}"
5353

5454
rmStep $OBJ_BINUTILS
5555

@@ -62,10 +62,9 @@ if [[ ! -d $STEP_DIR ]]; then
6262
$MAKE ARCH=$ARCH INSTALL_HDR_PATH=$OUT_DIR/$TARGET headers_install || exit 10
6363
) || err $?
6464

65-
echo -e "${GRN}Successfully extracted Linux headers${CLR}"
65+
printf "${GRN}Successfully extracted Linux headers${CLR}${NWL}"
6666
fi
6767

68-
6968
#
7069
# binutils
7170
#
@@ -74,7 +73,7 @@ SRC_DIR=$DEPS/binutils
7473
STEP_DIR=$OBJ_BINUTILS
7574

7675
if [[ ! -d $STEP_DIR ]]; then
77-
echo -e "${WHT}Compiling binutils${CLR}"
76+
printf "${WHT}Compiling binutils${CLR}${NWL}"
7877

7978
rmStep $OBJ_GCC_STATIC
8079

@@ -99,7 +98,7 @@ if [[ ! -d $STEP_DIR ]]; then
9998
$MAKE install || exit 23
10099
) || err $?
101100

102-
echo -e "${GRN}Successfully compiled binutils${CLR}"
101+
printf "${GRN}Successfully compiled binutils${CLR}${NWL}"
103102
fi
104103

105104

@@ -111,7 +110,7 @@ SRC_DIR=$DEPS/gcc
111110
STEP_DIR=$OBJ_GCC_STATIC
112111

113112
if [[ ! -d $STEP_DIR ]]; then
114-
echo -e "${WHT}Compiling GCC static${CLR}"
113+
printf "${WHT}Compiling GCC static${CLR}${NWL}"
115114

116115
rmStep $OBJ_MUSL
117116

@@ -160,7 +159,7 @@ if [[ ! -d $STEP_DIR ]]; then
160159
# [ToDo] Check if we can be able to generate them on different folders
161160
# rm -rf $STEP_DIR || exit 35
162161

163-
echo -e "${GRN}Successfully compiled GCC static${CLR}"
162+
printf "${GRN}Successfully compiled GCC static${CLR}${NWL}"
164163
fi
165164

166165

@@ -172,7 +171,7 @@ SRC_DIR=$DEPS/musl
172171
STEP_DIR=$OBJ_MUSL
173172

174173
if [[ ! -d $STEP_DIR ]]; then
175-
echo -e "${WHT}Compiling musl${CLR}"
174+
printf "${WHT}Compiling musl${CLR}${NWL}"
176175

177176
rmStep $OBJ_GCC_FINAL
178177

@@ -198,7 +197,7 @@ if [[ ! -d $STEP_DIR ]]; then
198197
DESTDIR=$OUT_DIR/$TARGET $MAKE install || exit 43
199198
) || err $?
200199

201-
echo -e "${GRN}Successfully compiled musl${CLR}"
200+
printf "${GRN}Successfully compiled musl${CLR}${NWL}"
202201
fi
203202

204203

@@ -210,7 +209,7 @@ SRC_DIR=$DEPS/gcc
210209
STEP_DIR=$OBJ_GCC_FINAL
211210

212211
if [[ ! -d $STEP_DIR ]]; then
213-
echo -e "${WHT}Compiling GCC final${CLR}"
212+
printf "${WHT}Compiling GCC final${CLR}${NWL}"
214213

215214
(
216215
mkdir -p $STEP_DIR &&
@@ -247,7 +246,7 @@ if [[ ! -d $STEP_DIR ]]; then
247246
$MAKE install || exit 53
248247
) || err $?
249248

250-
echo -e "${GRN}Successfully compiled GCC final${CLR}"
249+
printf "${GRN}Successfully compiled GCC final${CLR}${NWL}"
251250
fi
252251

253252

@@ -263,9 +262,9 @@ rm -rf {,share}/{info,man,doc} || exit 60
263262
# Strip libraries and binaries
264263
#
265264

266-
strip --strip-debug {,$TARGET/}lib/* &>> /dev/null
267-
strip --strip-unneeded {,$TARGET/}bin/* &>> /dev/null
265+
strip --strip-debug {,$TARGET/}lib/* > /dev/null
266+
strip --strip-unneeded {,$TARGET/}bin/* > /dev/null
268267

269-
strip --strip-unneeded libexec/gcc/$TARGET/*/*{,/*} &>> /dev/null
268+
strip --strip-unneeded libexec/gcc/$TARGET/*/*{,/*} > /dev/null
270269

271270
exit 0 # Ignore errors from `strip`

0 commit comments

Comments
 (0)