Skip to content

Commit

Permalink
Refactoring build
Browse files Browse the repository at this point in the history
The swift-tcl build is now created from 4 repositories. This makes it possible
to build Tcl extensions and programs using the Swift Package Manager.

make -C swift-tcl8.6 install
make -C swift-tcl install
make -C swift-tcl-demo test
make -C swift-tcl-extension-demo test
  • Loading branch information
Shannon Noe committed Jul 31, 2017
1 parent 58a2834 commit c3773c2
Show file tree
Hide file tree
Showing 15 changed files with 41 additions and 439 deletions.
5 changes: 3 additions & 2 deletions .gitignore
@@ -1,2 +1,3 @@
SwiftTcl.xcodeproj
.build
.build/*
Package.pins
SwiftTcl.xcodeproj/*
47 changes: 33 additions & 14 deletions Makefile
@@ -1,22 +1,41 @@
#
# tcl library path for brew - needs to be parameterized somehow
#
# version for TCL brew package
TCLVERSION=8.6.6_2
BREWROOT=/usr/local/Cellar
TCLLIBPATH=$(BREWROOT)/tcl-tk/$(TCLVERSION)/lib
TCLINCPATH=$(BREWROOT)/tcl-tk/$(TCLVERSION)/include
UNAME_S := $(shell uname -s)

BUILD=./.build
ifeq ($(UNAME_S),Linux)
EXTRA_SWIFTLINK=
TARGET = .build/debug/libSwiftTcl.so
endif

default: SwiftTcl.xcodeproj
ifeq ($(UNAME_S),Darwin)
TCLVERSION=8.6.6_2
BREWROOT=/usr/local/Cellar
TCLLIBPATH=$(BREWROOT)/tcl-tk/$(TCLVERSION)/lib
TCLINCPATH=$(BREWROOT)/tcl-tk/$(TCLVERSION)/include
EXTRA_SWIFTLINK=-Xlinker -L/usr/local/lib \
-Xlinker -L$(TCLLIBPATH) \
-Xcc -I$(TCLINCPATH)
TARGET = .build/debug/libSwiftTcl.dylib
endif

build: $(BUILD)
default: $(TARGET)

$(BUILD): Package.swift Makefile
swift build -Xlinker -L$(TCLLIBPATH) -Xlinker -ltcl8.6 -Xlinker -ltclstub8.6 -Xlinker -lz -Xcc -I$(TCLINCPATH)
$(TARGET): Package.swift Makefile
swift build $(EXTRA_SWIFTLINK)

SwiftTcl.xcodeproj: Package.swift Makefile build
swift package -Xlinker -L$(TCLLIBPATH) -Xlinker -ltcl8.6 -Xlinker -ltclstub8.6 generate-xcodeproj
swift package $(EXTRA_SWIFTLINK) generate-xcodeproj
@echo "NOTE: You will need to manually set the working directory for the SwiftTclDemo scheme to the root directory of this tree."
@echo "Thanks Apple"

ifeq ($(UNAME_S),Linux)
install: $(TARGET)
cp $(TARGET) /usr/lib/x86_64-linux-gnu
ldconfig /usr/lib/x86_64-linux-gnu/libSwiftTcl.so
endif

ifeq ($(UNAME_S),Darwin)
install: $(TARGET)
cp $(TARGET) /usr/local/lib
endif

clean:
rm -rf $(TARGET) .build Package.pins
9 changes: 5 additions & 4 deletions Package.swift
Expand Up @@ -4,9 +4,10 @@ import PackageDescription

let package = Package(
name: "SwiftTcl",
targets: [Target(name: "Tcl8_6"),
Target(name: "SwiftTcl_c", dependencies:["Tcl8_6"]),
Target(name: "SwiftTcl", dependencies:["SwiftTcl_c"]),
Target(name: "SwiftTclDemo", dependencies:["SwiftTcl"])]
dependencies: [
.Package(url: "https://github.com/flightaware/swift-tcl8.6.git", majorVersion: 1)
]
)

let libSwiftTcl = Product(name: "SwiftTcl", type: .Library(.Dynamic), modules: "SwiftTcl")
products.append(libSwiftTcl)
42 changes: 0 additions & 42 deletions Sources/SwiftTclDemo/impork-test.swift

This file was deleted.

0 comments on commit c3773c2

Please sign in to comment.