aboutsummaryrefslogtreecommitdiff
path: root/sys-build/gmake/build.lua
blob: 7a759d11ad8a3f2b719adb121d3541f67be24d84 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
local package = {}

local lfs = require("lfs")

package.name = "gmake"
package.version = "4.4.1"
package.description = "the gnu implementation of make"
package.arch = { "x86_64" }
package.license = { "GPLv3" }

package.deps = {
	build = {
		{ provides = "cc" },
		"sys-build/autoconf",
	},
}

package.sources = {
	{
		path = "https://ftp.nluug.nl/pub/gnu/make/make-4.4.1.tar.gz",
		hash = "09a4ad8060259e36854b525ab610fd317a86f4926e44e3ab8adba75dccc8d4b445df9dd25ccfb4c25a54bc0e98238a9127e36401d74cbc3503a329eadcdf4995",
		out = "source.tar.gz",
	},
}

-- shitty hack to remove version pinning and allow building on new autoconf versions

local function process_file(path)
	local f = io.open(path, "r")
	if not f then
		return
	end

	local content = f:read("*a")
	f:close()

	if content:find("1[.-]16") then
		content = content:gsub("1([.-])16", "1%118")

		f = assert(io.open(path, "w"))
		f:write(content)
		f:close()

		print("Updated: " .. path)
	end
end

local function walk(dir)
	for entry in lfs.dir(dir) do
		if entry ~= "." and entry ~= ".." then
			local path = dir .. "/" .. entry
			local attr = lfs.attributes(path)

			if attr and attr.mode == "directory" then
				if entry ~= ".git" then
					walk(path)
				end
			elseif attr and attr.mode == "file" then
				process_file(path)
			end
		end
	end
end

package.build = function()
	print(lfs.currentdir())

	pow.extract("source.tar.gz", "source")

	lfs.chdir("source/make-4.4.1")

	walk(".")

	os.execute("./configure")

	os.execute("make")
end

return package