From 63872f6e619ea34a89eae1b9efe43d428fbd480f Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Mon, 12 Dec 2016 23:52:36 +0000 Subject: [PATCH] Added automated scripts for building on windows 10 --- README.md | 2 +- build.cmd | 15 ++++++++ tools/setup-wsfl.cmd | 56 ++++++++++++++++++++++++++++ tools/setup-wsfl.sh | 87 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 159 insertions(+), 1 deletion(-) create mode 100644 build.cmd create mode 100644 tools/setup-wsfl.cmd create mode 100644 tools/setup-wsfl.sh diff --git a/README.md b/README.md index 8c9e910..470c48b 100644 --- a/README.md +++ b/README.md @@ -136,4 +136,4 @@ $ git clone https://github.com/parasyte/alt64.git $ make ``` -If it all worked, you will find `OS64.v64` in the `alt64` top-level directory. +If it all worked, you will find `OS64.v64` in the `alt64` bin directory. diff --git a/build.cmd b/build.cmd new file mode 100644 index 0000000..83d08bf --- /dev/null +++ b/build.cmd @@ -0,0 +1,15 @@ +@echo off +set env="/usr/local/libdragon" + +IF %1.==. GOTO default + +bash --verbose -c "export N64_INST=%env%; make %1" + +GOTO end + +:default +bash --verbose -c "export N64_INST=%env%; make" + +:end + +pause \ No newline at end of file diff --git a/tools/setup-wsfl.cmd b/tools/setup-wsfl.cmd new file mode 100644 index 0000000..a4495d2 --- /dev/null +++ b/tools/setup-wsfl.cmd @@ -0,0 +1,56 @@ +:::::::::::::::::::::::::::::::::::::::::::: +:: Elevate.cmd - Version 2 +:: Automatically check & get admin rights +:::::::::::::::::::::::::::::::::::::::::::: +@echo off +CLS +ECHO. +ECHO ============================= +ECHO Running Admin shell +ECHO ============================= + +:init +setlocal DisableDelayedExpansion +set "batchPath=%~0" +for %%k in (%0) do set batchName=%%~nk +set "vbsGetPrivileges=%temp%\OEgetPriv_%batchName%.vbs" +setlocal EnableDelayedExpansion + +:checkPrivileges +NET FILE 1>NUL 2>NUL +if '%errorlevel%' == '0' ( goto gotPrivileges ) else ( goto getPrivileges ) + +:getPrivileges +if '%1'=='ELEV' (echo ELEV & shift /1 & goto gotPrivileges) +ECHO. +ECHO ************************************** +ECHO Invoking UAC for Privilege Escalation +ECHO ************************************** + +ECHO Set UAC = CreateObject^("Shell.Application"^) > "%vbsGetPrivileges%" +ECHO args = "ELEV " >> "%vbsGetPrivileges%" +ECHO For Each strArg in WScript.Arguments >> "%vbsGetPrivileges%" +ECHO args = args ^& strArg ^& " " >> "%vbsGetPrivileges%" +ECHO Next >> "%vbsGetPrivileges%" +ECHO UAC.ShellExecute "!batchPath!", args, "", "runas", 1 >> "%vbsGetPrivileges%" +"%SystemRoot%\System32\WScript.exe" "%vbsGetPrivileges%" %* +exit /B + +:gotPrivileges +setlocal & pushd . +cd /d %~dp0 +if '%1'=='ELEV' (del "%vbsGetPrivileges%" 1>nul 2>nul & shift /1) + +:::::::::::::::::::::::::::: +::START +:::::::::::::::::::::::::::: +@echo on + +lxrun /install /y +bash -c "echo 'export N64_INST=/usr/local/libdragon' >> ~/.bashrc; source ~/.bashrc" +bash -c "chmod +x ./setup-wsfl.sh" +bash --verbose -c "source ./setup-wsfl.sh" + +::bash + +pause diff --git a/tools/setup-wsfl.sh b/tools/setup-wsfl.sh new file mode 100644 index 0000000..a4d6ee5 --- /dev/null +++ b/tools/setup-wsfl.sh @@ -0,0 +1,87 @@ +#!/bin/bash +# Download and install latest updates for the system [sudo req.] +apt-get update +apt-get -y upgrade + +# Install essential packages [sudo req.] +apt-get -y install build-essential git texinfo libc6 libgmp-dev libmpfr-dev libmpc-dev libpng-dev zlib1g-dev libtool autoconf + +# change to the users root directory +cd ~/ + +# add a system variable and make it perminent +# echo 'N64_INST=/usr/local/libdragon' >> /etc/environment +# echo 'export N64_INST=/usr/local/libdragon' >> ~/.bashrc +export N64_INST=/usr/local/libdragon +# source ~/.bashrc + +# Pull the latest libdragon source code and make a build directory +git clone https://github.com/dragonminded/libdragon.git + +# fix issues with the build scripts +sed -i -- 's|${N64_INST:-/usr/local}|/usr/local/libdragon|g' libdragon/tools/build +sed -i -- 's|--with-newlib|--with-newlib --with-system-zlib|g' libdragon/tools/build + +sed -i -- 's| -lpng|\nLDLIBS = -lpng|g' libdragon/tools/mksprite/Makefile +sed -i -- 's| -Werror| -w|g' libdragon/tools/mksprite/Makefile + +# make a build folder for libdragon +mkdir libdragon/build_gcc +cp libdragon/tools/build libdragon/build_gcc + +# run the build script (this will take a while! and if not sudo, will ask for password mid flow!) +cd libdragon/build_gcc +./build + +cd .. +# run the install script [sudo req] +make +make install +make tools +make tools-install + +cd .. +# install libmikmod +git clone https://github.com/parasyte/libmikmod-n64.git +cd libmikmod-n64 +mkdir build +make +make install + +cd .. +# install libmad-64 +git clone https://github.com/parasyte/libmad-n64.git +cd libmad-n64 +#$(N64_INST) converterd to $N64_INST below otherwise it will not run on WSFL +export PATH=$PATH:$N64_INST/bin +CFLAGS="-march=vr4300 -mtune=vr4300 -mno-extern-sdata" \ +LDFLAGS="-L$N64_INST/lib" LIBS="-lc -lnosys" \ +./configure --host=mips64-elf --disable-shared \ +--prefix=$N64_INST --enable-speed --enable-fpm=mips +make +make install + +cd .. +# install libyaml +git clone https://github.com/yaml/libyaml +cd libyaml +./bootstrap +#$(N64_INST) converterd to $N64_INST below otherwise it will not run on WSFL +export PATH=$PATH:$N64_INST/bin +CFLAGS="-std=gnu99 -march=vr4300 -mtune=vr4300" \ +LDFLAGS="-L$N64_INST/lib -Tn64ld.x" \ +LIBS="-ldragon -lc -ldragonsys -lnosys" \ +./configure --host=mips64-elf --prefix=$N64_INST +make +make install + +cd .. +# Install menu code (perhaps this script should be called from it instead? +# git clone https://github.com/networkfusion/alt64.git +# cd alt64 +# make + +# Perform cleanup +apt-get -y autoremove +apt-get autoclean +