Skip to content

Commit

Permalink
Fix build process for .NET Core 2.2 on Mac and Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
roblillack committed Jul 31, 2019
1 parent 409316d commit a3f3f7a
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 19 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
bin
/bin
/obj
/tmp
*.pidb
test-results
*.userprefs
Empty file removed .gitmodules
Empty file.
57 changes: 39 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,30 +1,51 @@
PREFIX=/usr/local
VERSION=`git describe`

all: bin/Release/tack.exe
all: build-mac build-linux

bin/Release/tack.exe: lib/markdownsharp/bin/Release/MarkdownSharp.dll ext/nustache/Nustache.Core/bin/Release/Nustache.Core.dll
xbuild /property:Configuration=Release tack.csproj
uninstall:
rm -rf ${PREFIX}/bin/tack ${PREFIX}/lib/tack ${PREFIX}/share/tack

lib/markdownsharp/bin/Release/MarkdownSharp.dll:
xbuild /property:Configuration=Release lib/markdownsharp/MarkdownSharp.csproj
run:
dotnet run tack.csproj

ext/nustache/Nustache.Core/Nustache.Core.csproj:
git submodule init
git submodule update
build-mac:
dotnet publish -c Release -r osx-x64

ext/nustache/Nustache.Core/bin/Release/Nustache.Core.dll: ext/nustache/Nustache.Core/Nustache.Core.csproj
xbuild /property:Configuration=Release ext/nustache/Nustache.Core/Nustache.Core.csproj
install-mac: build-mac
install -d ${PREFIX}/lib/tack
install bin/Release/netcoreapp2.2/osx-x64/publish/* ${PREFIX}/lib/tack
install tack.sh ${PREFIX}/bin/tack
chmod a+rx ${PREFIX}/bin/tack

install: bin/Release/tack.exe
install -d ${PREFIX}/share/tack
install bin/Release/* ${PREFIX}/share/tack
printf '#!/bin/sh\nmono '${PREFIX}'/share/tack/tack.exe $$@\n' > ${PREFIX}/bin/tack
package-mac: build-mac
rm -rf tmp
install -d tmp/lib/tack tmp/bin
install bin/Release/netcoreapp2.2/osx-x64/publish/* tmp/lib/tack
install tack.sh tmp/bin/tack
chmod a+rx tmp/bin/tack
tar -C tmp -czvf tack_${VERSION}_osx-x64.tgz bin lib
rm -rf tmp

build-linux:
dotnet publish -c Release -r linux-x64

install-linux: build-linux
install -d ${PREFIX}/lib/tack
install bin/Release/netcoreapp2.2/linux-x64/publish/* ${PREFIX}/lib/tack
install tack.sh ${PREFIX}/bin/tack
chmod a+rx ${PREFIX}/bin/tack

uninstall:
rm -rf ${PREFIX}/bin/tack ${PREFIX}/share/tack
package-linux: build-linux
rm -rf tmp
install -d tmp/lib/tack tmp/bin
install bin/Release/netcoreapp2.2/linux-x64/publish/* tmp/lib/tack
install tack.sh tmp/bin/tack
chmod a+rx tmp/bin/tack
tar -C tmp -czvf tack_${VERSION}_linux-x64.tgz bin lib
rm -rf tmp

clean:
rm -rf bin/ obj/ ext/nustache/bin/ ext/nustache/obj/ lib/markdownsharp/obj/ lib/markdownsharp/bin/
rm -rf bin/ obj/

.PHONY: uninstall
.PHONY: uninstall build-mac install-mac run build-linux install-linux package-linux package-mac clean
6 changes: 6 additions & 0 deletions tack.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh

DIRNAME=`dirname $0`
PREFIX=`cd $DIRNAME && pwd`

$PREFIX/../lib/tack/tack $@

0 comments on commit a3f3f7a

Please sign in to comment.