1
0
mirror of https://github.com/mintty/wsltty.git synced 2024-10-05 18:31:04 +01:00
wsltty/makefile

318 lines
9.1 KiB
Makefile
Raw Normal View History

2016-09-11 13:20:39 +01:00
#############################################################################
2017-01-30 15:31:17 +00:00
# build a wsltty installer package:
# configure ver=... and minttyver= in this makefile
# make targets:
2018-02-06 09:51:07 +00:00
# make [all] build a distributable installer (default)
# make pkg build an installer, bypassing the system checks
# make build build the software (no installer)
# make install install wsltty locally from build (no installer needed)
2018-02-06 09:51:07 +00:00
# make wsltty build the software, using the local copy of mintty
2017-01-30 15:31:17 +00:00
2016-09-11 13:20:39 +01:00
# wsltty release
2020-11-10 23:00:00 +00:00
ver=3.4.3
2018-11-14 07:06:26 +00:00
# wsltty appx release - must have 4 parts!
2020-11-10 23:00:00 +00:00
verx=3.4.3.0
2020-04-02 13:44:21 +01:00
2018-11-14 07:06:26 +00:00
2020-10-24 16:22:10 +01:00
##############################
# mintty release version
2017-12-15 20:58:28 +00:00
2020-11-10 23:00:00 +00:00
minttyver=3.4.3
2020-10-24 16:22:10 +01:00
##############################
# wslbridge2 repository
repo=Biswa96/wslbridge2
# wslbridge2 master release version
wslbridgever=0.6
# wslbridge2 latest version
#archive=master
#wslbridgedir=wslbridge2-$(archive)
# wslbridge2 branch or commit version (from fix-window-resize branch) and dir
#commit=70e0dcea1db122d076ce1578f2a45280cc92d09f
#commit=8b6dd7ee2b3102d72248990c21764c5cf86c6612
#archive=$(commit)
#wslbridgedir=wslbridge2-$(archive)
# wslbridge2 fork repository and version
#repo=mintty/wslbridge2
#wslbridgever=0.5.1
# wslbridge2 release or fork archive and dir
archive=v$(wslbridgever)
wslbridgedir=wslbridge2-$(wslbridgever)
2020-06-11 15:39:39 +01:00
2017-12-15 20:58:28 +00:00
##############################
2017-06-24 00:32:20 +01:00
2019-10-06 15:36:19 +01:00
# mintty branch or commit version
#minttyver=master
# wslbridge branch or commit to build from source;
wslbridge=wslbridge-frontend wslbridge-backend
2017-12-15 20:58:28 +00:00
2020-04-02 13:44:21 +01:00
##############################
# build backend on a musl-libc-based distribution
# (reportedly not needed anymore but untested)
BuildDistr=-d Alpine
2019-10-06 15:36:19 +01:00
##############################
# Windows SDK version for appx
WINSDKKEY=/HKEY_LOCAL_MACHINE/SOFTWARE/WOW6432Node/Microsoft/.NET Framework Platform/Setup/Multi-Targeting Pack
WINSDKVER=`regtool list '$(WINSDKKEY)' | sed -e '$$ q' -e d`
2017-12-15 20:58:28 +00:00
#############################################################################
# default target
2018-07-02 00:26:08 +01:00
all: all-$(notdir $(CURDIR))
all-wsltty: check pkg
all-wsltty.appx: appx
2017-12-15 20:58:28 +00:00
#############################################################################
# target checking and some defs
2016-09-11 13:20:39 +01:00
TARGET := $(shell $(CC) -dumpmachine)
ifeq ($(TARGET), i686-pc-cygwin)
sys := cygwin32
else ifeq ($(TARGET), x86_64-pc-cygwin)
sys := cygwin64
else ifeq ($(TARGET), i686-pc-msys)
sys := msys32
else ifeq ($(TARGET), x86_64-pc-msys)
sys := msys64
else
$(error Target '$(TARGET)' not supported)
endif
wget=curl -R -L --connect-timeout 55 -O
wgeto=curl -R -L --connect-timeout 55
2016-09-14 14:37:55 +01:00
#############################################################################
2018-02-06 09:51:07 +00:00
# system check:
# - ensure the path name drag-and-drop adaptation works (-> Cygwin, not MSYS)
# - 64 Bit (x86_64) for more stable invocation (avoid fork issues)
arch:=$(shell uname -m)
check: # checkarch
echo Building for:
echo $(arch) | grep .
# checking suitable host environment; run `make pkg` to bypass
2016-11-15 11:41:19 +00:00
# check cygwin (vs msys) for proper drag-and-drop paths:
uname | grep CYGWIN
checkarch:
2018-02-06 09:51:07 +00:00
# check 32 bit to ensure 32-Bit Windows support, just in case:
2017-04-14 00:08:20 +01:00
#uname -m | grep i686
2018-02-06 09:51:07 +00:00
# check 64 bit to provide 64-Bit stability support:
#uname -m | grep x86_64
2018-11-14 07:06:26 +00:00
#############################################################################
# patch version information for appx package configuration
fix-verx:
echo patching $(WINSDKVER) into Launcher config
cd Launcher; sed -i~ -e "/<supportedRuntime / s,Version=v[.0-9]*,Version=$(WINSDKVER)," app.config
echo patched app.config
cd Launcher; sed -i~ -e "/<TargetFrameworkVersion>/ s,v[.0-9]*,$(WINSDKVER)," Launcher.csproj
echo patched Launcher.csproj
echo patching $(verx) into app config
sed -i~ -e '/<Identity / s,Version="[.0-9]*",Version="$(verx)",' AppxManifest.xml
echo patched AppxManifest.xml
2020-06-11 15:39:39 +01:00
#############################################################################
# clear binaries
clean:
2020-10-24 16:22:10 +01:00
rm -fr $(wslbridgedir)/bin
2020-06-11 15:39:39 +01:00
rm -fr bin
2016-09-11 13:20:39 +01:00
#############################################################################
# generation
2017-12-15 20:58:28 +00:00
wslbridge: $(wslbridge)
2020-10-24 16:22:10 +01:00
$(wslbridgedir).zip:
$(wgeto) https://github.com/$(repo)/archive/$(archive).zip -o $(wslbridgedir).zip
2017-12-15 20:58:28 +00:00
2020-10-24 16:22:10 +01:00
wslbridge-source: $(wslbridgedir).zip
unzip -o $(wslbridgedir).zip
cp $(wslbridgedir)/LICENSE LICENSE.wslbridge2
# patch
cd $(wslbridgedir); patch -p1 < ../0001-notify-size-change-inband.patch
2018-01-09 15:35:05 +00:00
2017-12-15 20:58:28 +00:00
wslbridge-frontend: wslbridge-source
2019-10-01 23:57:48 +01:00
echo ------------- Compiling wslbridge2 frontend
mkdir -p bin
2019-10-13 23:00:00 +01:00
# frontend build
2020-10-24 16:22:10 +01:00
cd $(wslbridgedir)/src; make -f Makefile.frontend RELEASE=1
2019-10-13 23:00:00 +01:00
# extract binaries
2020-10-24 16:22:10 +01:00
cp $(wslbridgedir)/bin/wslbridge2.exe bin/
2019-10-01 23:57:48 +01:00
windir=$(shell cd "${WINDIR}"; pwd)
2019-10-01 23:57:48 +01:00
wslbridge-backend: wslbridge-source
echo ------------- Compiling wslbridge2 backend
#uname -m | grep x86_64
2017-12-15 20:58:28 +00:00
mkdir -p bin
2019-10-13 23:00:00 +01:00
# provide dependencies for backend build
2020-04-02 13:44:21 +01:00
PATH="$(windir)/Sysnative:${PATH}" cmd /C wsl.exe -u root $(BuildDistr) $(shell env | grep http_proxy=) apk add make g++ linux-headers < /dev/null
2019-10-13 23:00:00 +01:00
# invoke backend build
2020-10-24 16:22:10 +01:00
cd $(wslbridgedir)/src; PATH="$(windir)/Sysnative:${PATH}" cmd /C wsl.exe $(BuildDistr) make -f Makefile.backend RELEASE=1 < /dev/null
2019-10-13 23:00:00 +01:00
# extract binaries
2020-10-24 16:22:10 +01:00
cp $(wslbridgedir)/bin/wslbridge2-backend bin/
mintty-get:
$(wgeto) https://github.com/mintty/mintty/archive/$(minttyver).zip -o mintty-$(minttyver).zip
unzip -o mintty-$(minttyver).zip
cp mintty-$(minttyver)/icon/terminal.ico mintty.ico
2017-10-22 23:01:54 +01:00
wslbuild=LDFLAGS="-static -static-libgcc -s"
appxbuild=$(wslbuild) CCOPT=-DWSLTTY_APPX
2017-10-22 23:01:54 +01:00
wslversion=VERSION_SUFFIX=" wsltty $(ver)" WSLTTY_VERSION="$(ver)"
2018-07-04 20:37:53 +01:00
appxversion=VERSION_SUFFIX=" wsltty appx $(verx)" WSLTTY_VERSION="$(verx)"
2017-10-22 23:01:54 +01:00
mintty-build:
# ensure rebuild of version-specific check and message
rm -f mintty-$(minttyver)/bin/*/windialog.o
# build mintty
2017-10-22 23:01:54 +01:00
cd mintty-$(minttyver)/src; make $(wslbuild) $(wslversion)
2016-09-11 13:20:39 +01:00
mkdir -p bin
cp mintty-$(minttyver)/bin/mintty.exe bin/
2019-04-10 23:00:00 +01:00
strip bin/mintty.exe
2018-07-02 00:26:08 +01:00
2018-07-04 20:37:53 +01:00
mintty-build-appx:
# ensure rebuild of version-specific check and message
rm -f mintty-$(minttyver)/bin/*/windialog.o
# build mintty
cd mintty-$(minttyver)/src; make $(appxbuild) $(appxversion)
mkdir -p bin
cp mintty-$(minttyver)/bin/mintty.exe bin/
2019-04-10 23:00:00 +01:00
strip bin/mintty.exe
2018-07-04 20:37:53 +01:00
2018-07-02 00:26:08 +01:00
mintty-pkg:
cp mintty-$(minttyver)/LICENSE LICENSE.mintty
cd mintty-$(minttyver)/lang; zoo a lang *.po; mv lang.zoo ../../
cd mintty-$(minttyver)/themes; zoo a themes *[!~]; mv themes.zoo ../../
2019-05-03 04:01:28 +01:00
cd mintty-$(minttyver)/sounds; zoo a sounds *.wav *.WAV *.md; mv sounds.zoo ../../
# add charnames.txt to support "Character Info"
cd mintty-$(minttyver)/src; sh ./mknames
cp mintty-$(minttyver)/src/charnames.txt .
2016-09-11 13:20:39 +01:00
2018-07-02 00:26:08 +01:00
mintty-appx:
mkdir -p usr/share/mintty
2019-05-03 04:01:28 +01:00
cd usr/share/mintty; mkdir -p lang themes sounds info
2018-07-02 00:26:08 +01:00
cp mintty-$(minttyver)/lang/*.po usr/share/mintty/lang/
cp mintty-$(minttyver)/themes/*[!~] usr/share/mintty/themes/
2019-05-03 04:01:28 +01:00
cp mintty-$(minttyver)/sounds/*.wav usr/share/mintty/sounds/
cp mintty-$(minttyver)/sounds/*.WAV usr/share/mintty/sounds/
2018-07-02 00:26:08 +01:00
# add charnames.txt to support "Character Info"
cd mintty-$(minttyver)/src; sh ./mknames
cp mintty-$(minttyver)/src/charnames.txt usr/share/mintty/info/
2019-08-07 22:48:03 +01:00
cygwin: # mkshortcutexe
2016-09-11 13:20:39 +01:00
mkdir -p bin
cp /bin/cygwin1.dll bin/
cp /bin/cygwin-console-helper.exe bin/
cp /bin/dash.exe bin/
cp /bin/regtool.exe bin/
2017-01-06 15:47:13 +00:00
cp /bin/zoo.exe bin/
2016-09-11 13:20:39 +01:00
2019-08-07 19:37:08 +01:00
mkshortcutexe: bin/mkshortcut.exe
bin/mkshortcut.exe: mkshortcut.c
echo mksh
gcc -o bin/mkshortcut mkshortcut.c -lpopt -lole32 /usr/lib/w32api/libuuid.a
cp /bin/cygpopt-0.dll bin/
2019-08-07 19:51:34 +01:00
cp /bin/cygiconv-2.dll bin/
cp /bin/cygintl-8.dll bin/
2018-07-02 00:26:08 +01:00
appx-bin:
mkdir -p bin
cp /bin/cygwin1.dll bin/
cp /bin/cygwin-console-helper.exe bin/
CAB=wsltty-$(ver)-$(arch)
copcab: ver
mkdir -p $(CAB)
cp bin/cygwin1.dll $(CAB)/
cp bin/cygwin-console-helper.exe $(CAB)/
cp bin/dash.exe $(CAB)/
cp bin/regtool.exe $(CAB)/
cp bin/mintty.exe $(CAB)/
cp bin/zoo.exe $(CAB)/
cp lang.zoo $(CAB)/
cp themes.zoo $(CAB)/
cp sounds.zoo $(CAB)/
cp charnames.txt $(CAB)/
cp bin/wslbridge2.exe $(CAB)/
cp bin/wslbridge2-backend $(CAB)/
cp mkshortcut.vbs $(CAB)/
#cp bin/mkshortcut.exe $(CAB)/
#cp bin/cygpopt-0.dll $(CAB)/
#cp bin/cygiconv-2.dll $(CAB)/
#cp bin/cygintl-8.dll $(CAB)/
cp LICENSE.* $(CAB)/
cp VERSION $(CAB)/
cp *.lnk $(CAB)/
cp *.ico $(CAB)/
cp *.url $(CAB)/
cp *.bat $(CAB)/
cp config-distros.sh $(CAB)/
2020-11-10 23:00:00 +00:00
cp mkshortcut.vbs $(CAB)/
cop: copcab
2016-09-11 13:20:39 +01:00
mkdir -p rel
cp -fl $(CAB)/* rel/
installer: cop
# prepare build of installer
rm -f rel/wsltty-$(ver)-install-$(arch).exe
sed -e "s,%version%,$(ver)," -e "s,%arch%,$(arch)," makewinx.cfg > rel/wsltty.SED
# build installer
2016-09-11 13:20:39 +01:00
cd rel; iexpress /n wsltty.SED
# build cab archive
lcab -r $(CAB) rel/$(CAB).cab
2016-09-11 13:20:39 +01:00
2017-05-19 21:20:23 +01:00
install: cop installbat
installbat:
cd rel; cmd /C install
ver:
echo $(ver) > VERSION
2018-07-02 00:26:08 +01:00
mintty: mintty-get mintty-build
mintty-usr: mintty-get mintty-appx
# local wsltty build target:
wsltty: wslbridge cygwin mintty-build mintty-pkg
# build software without installer:
build: wslbridge cygwin mintty-get mintty-build mintty-pkg
2018-07-02 00:26:08 +01:00
# standalone wsltty package build target:
pkg: wslbridge cygwin mintty-get mintty-build mintty-pkg installer
2018-07-02 00:26:08 +01:00
# appx package contents target:
2018-07-04 20:37:53 +01:00
wsltty-appx: wslbridge appx-bin mintty-get mintty-build-appx mintty-appx
2018-07-02 00:26:08 +01:00
# appx package target:
2018-11-14 07:06:26 +00:00
appx: wsltty-appx fix-verx
2018-07-02 00:26:08 +01:00
sh ./build.sh
2017-01-06 15:47:13 +00:00
2016-09-11 13:20:39 +01:00
#############################################################################
# end