Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Commit

Permalink
Use dylib instead of so on Mac OSX
Browse files Browse the repository at this point in the history
  • Loading branch information
mgreter committed Jul 23, 2019
1 parent 58d1066 commit 50feccb
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 15 deletions.
38 changes: 29 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,10 @@ STATICLIB = lib/libsass.a
SHAREDLIB = lib/libsass.so
LIB_STATIC = $(SASS_LIBSASS_PATH)/lib/libsass.a
LIB_SHARED = $(SASS_LIBSASS_PATH)/lib/libsass.so

ifeq ($(UNAME),Darwin)
SHAREDLIB = lib/libsass.dylib
LIB_SHARED = $(SASS_LIBSASS_PATH)/lib/libsass.dylib
endif
ifeq (Windows,$(UNAME))
SASSC_BIN = $(SASS_SASSC_PATH)/bin/sassc.exe
RESOURCES += res/resource.rc
Expand Down Expand Up @@ -206,8 +209,13 @@ lib/libsass.a: $(COBJECTS) $(OBJECTS) | lib
lib/libsass.so: $(COBJECTS) $(OBJECTS) | lib
$(CXX) -shared $(LDFLAGS) -o $@ $(COBJECTS) $(OBJECTS) $(LDLIBS)

lib/libsass.dylib: $(COBJECTS) $(OBJECTS) | lib
$(CXX) -shared $(LDFLAGS) -o $@ $(COBJECTS) $(OBJECTS) $(LDLIBS) \
-install_name @rpath/libsass.dylib

lib/libsass.dll: $(COBJECTS) $(OBJECTS) $(RCOBJECTS) | lib
$(CXX) -shared $(LDFLAGS) -o $@ $(COBJECTS) $(OBJECTS) $(RCOBJECTS) $(LDLIBS) -s -Wl,--subsystem,windows,--out-implib,lib/libsass.a
$(CXX) -shared $(LDFLAGS) -o $@ $(COBJECTS) $(OBJECTS) $(RCOBJECTS) $(LDLIBS) \
-s -Wl,--subsystem,windows,--out-implib,lib/libsass.a

%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
Expand Down Expand Up @@ -262,13 +270,17 @@ $(DESTDIR)$(PREFIX)/lib/%.dll: lib/%.dll \
| $(DESTDIR)$(PREFIX)/lib
@$(INSTALL) -v -m0755 "$<" "$@"

$(DESTDIR)$(PREFIX)/lib/%.dylib: lib/%.dylib \
| $(DESTDIR)$(PREFIX)/lib
@$(INSTALL) -v -m0755 "$<" "$@"

install-static: $(DESTDIR)$(PREFIX)/lib/libsass.a

install-shared: $(DESTDIR)$(PREFIX)/lib/libsass.so \
install-shared: $(DESTDIR)$(PREFIX)/$(SHAREDLIB) \
install-headers

$(SASSC_BIN): $(BUILD)
$(MAKE) -C $(SASS_SASSC_PATH) build-$(BUILD)-dev
$(MAKE) -C $(SASS_SASSC_PATH) build-$(BUILD)

sassc: $(SASSC_BIN)
$(SASSC_BIN) -v
Expand All @@ -279,19 +291,27 @@ version: $(SASSC_BIN)
test: test_build

test_build: $(SASSC_BIN)
$(RUBY_BIN) $(SASS_SPEC_PATH)/sass-spec.rb -c $(SASSC_BIN) --impl libsass $(LOG_FLAGS) $(SASS_SPEC_PATH)/$(SASS_SPEC_SPEC_DIR)
$(RUBY_BIN) $(SASS_SPEC_PATH)/sass-spec.rb -c $(SASSC_BIN) --impl libsass \
--cmd-args "-I $(SASS_SPEC_PATH)/$(SASS_SPEC_SPEC_DIR)" \
$(LOG_FLAGS) $(SASS_SPEC_PATH)/$(SASS_SPEC_SPEC_DIR)

test_full: $(SASSC_BIN)
$(RUBY_BIN) $(SASS_SPEC_PATH)/sass-spec.rb -c $(SASSC_BIN) --impl libsass --run-todo $(LOG_FLAGS) $(SASS_SPEC_PATH)/$(SASS_SPEC_SPEC_DIR)
$(RUBY_BIN) $(SASS_SPEC_PATH)/sass-spec.rb -c $(SASSC_BIN) --impl libsass \
--cmd-args "-I $(SASS_SPEC_PATH)/$(SASS_SPEC_SPEC_DIR)" \
--run-todo $(LOG_FLAGS) $(SASS_SPEC_PATH)/$(SASS_SPEC_SPEC_DIR)

test_probe: $(SASSC_BIN)
$(RUBY_BIN) $(SASS_SPEC_PATH)/sass-spec.rb -c $(SASSC_BIN) --impl libsass --probe-todo $(LOG_FLAGS) $(SASS_SPEC_PATH)/$(SASS_SPEC_SPEC_DIR)
$(RUBY_BIN) $(SASS_SPEC_PATH)/sass-spec.rb -c $(SASSC_BIN) --impl libsass \
--cmd-args "-I $(SASS_SPEC_PATH)/$(SASS_SPEC_SPEC_DIR)" \
--probe-todo $(LOG_FLAGS) $(SASS_SPEC_PATH)/$(SASS_SPEC_SPEC_DIR)

test_interactive: $(SASSC_BIN)
$(RUBY_BIN) $(SASS_SPEC_PATH)/sass-spec.rb -c $(SASSC_BIN) --impl libsass --interactive $(LOG_FLAGS) $(SASS_SPEC_PATH)/$(SASS_SPEC_SPEC_DIR)
$(RUBY_BIN) $(SASS_SPEC_PATH)/sass-spec.rb -c $(SASSC_BIN) --impl libsass \
--cmd-args "-I $(SASS_SPEC_PATH)/$(SASS_SPEC_SPEC_DIR)" \
--interactive $(LOG_FLAGS) $(SASS_SPEC_PATH)/$(SASS_SPEC_SPEC_DIR)

clean-objects: | lib
-$(RM) lib/*.a lib/*.so lib/*.dll lib/*.la
-$(RM) lib/*.a lib/*.so lib/*.dll lib/*.dylib lib/*.la
-$(RMDIR) lib
clean: clean-objects
$(RM) $(CLEANUPS)
Expand Down
10 changes: 4 additions & 6 deletions script/ci-build-libsass
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,14 @@ if [ "x$AUTOTOOLS" == "xyes" ]; then

make $MAKE_OPTS clean

# install to prefix directory
PREFIX="$PREFIX" make $MAKE_OPTS install

else

make $MAKE_OPTS clean

# Run C++ unit tests
make -C test clean
make -C test test

fi

# install to prefix directory
Expand Down Expand Up @@ -128,10 +126,10 @@ then
echo "Fetching Sass Spec PR $SPEC_PR"
git -C sass-spec fetch -u origin pull/$SPEC_PR/head:ci-spec-pr-$SPEC_PR
git -C sass-spec checkout --force ci-spec-pr-$SPEC_PR
make LD_LIBRARY_PATH="$PREFIX/lib/" DYLD_LIBRARY_PATH="$PREFIX/lib/" $MAKE_OPTS test_probe
make $MAKE_OPTS test_probe
else
make LD_LIBRARY_PATH="$PREFIX/lib/" DYLD_LIBRARY_PATH="$PREFIX/lib/" $MAKE_OPTS test_probe
make $MAKE_OPTS test_probe
fi
else
make LD_LIBRARY_PATH="$PREFIX/lib/" DYLD_LIBRARY_PATH="$PREFIX/lib/" $MAKE_OPTS test_probe
make $MAKE_OPTS test_probe
fi

0 comments on commit 50feccb

Please sign in to comment.