Skip to content

Commit

Permalink
Add 'install_data' build action
Browse files Browse the repository at this point in the history
  • Loading branch information
jushar committed Aug 1, 2016
1 parent 0aa3b61 commit a8efd20
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ Download and install the [EditorConfig](https://visualstudiogallery.msdn.microso
1. Execute `create-projects.bat`
2. Open `Build\MTASA.sln`
3. Compile
4. Install data files: `utils\premake5.exe install_data`
5. Install resources: `utils\premake5.exe install_resources` (optional step)

#### Linux
1. Execute `utils/premake5_x86 gmake` (32-bit OS) or `utils/premake5_x64 gmake` (64-bit OS)
Expand Down
1 change: 1 addition & 0 deletions premake5.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
-- Add buildactions to path
premake.path = premake.path..";utils/buildactions"
require "compose_files"
require "install_data"
require "install_resources"

workspace "MTASA"
Expand Down
47 changes: 47 additions & 0 deletions utils/buildactions/install_data.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
require 'utils'

premake.modules.install_data = {}

-- Config variables
local BIN_DIR = "Bin"
local DATA_DIR = "Shared/data/MTA San Andreas"

-- TODO
local NET_PATH_X86_WIN = "https://"
--local NET_PATH_X64_WIN = "https://"
local NET_PATH_X86_LINUX = "https://"
--local NET_PATH_X64_LINUX = "https://"
local NETC_PATH_WIN = "https://"

newaction {
trigger = "install_data",
description = "Installs data files",

execute = function()
-- Make Bin directory if not exists
os.mkdir(BIN_DIR)

-- Copy data files
os.copydir(DATA_DIR, BIN_DIR)

if false then -- TODO
if os.get() == "windows" then
http.download(NET_PATH_X86_WIN, BIN_DIR.."/server/net.dll")
--http.download(NET_PATH_X64_WIN, BIN_DIR.."/server/x64/mods/net.dll")
http.download(NETC_PATH_WIN, BIN_DIR.."/MTA/netc.dll")

os.copyfile("/MTA/netc.dll", "/MTA/netc_d.dll")
os.copyfile("/server/net.dll", "/server/net_d.dll")
--os.copyfile("/server/x64/net.dll", "/server/x64/net_d.dll")
else
http.download(NET_PATH_X86_LINUX, BIN_DIR.."/server/net.so")
--http.download(NET_PATH_X64_LINUX, BIN_DIR.."/server/x64/mods/net.so")

os.copyfile("/server/net.so", "/server/net_d.so")
--os.copyfile("/server/x64/net.so", "/server/x64/net_d.so")
end
end
end
}

return premake.modules.install_data

0 comments on commit a8efd20

Please sign in to comment.