nsf / termbox

Library for writing text-based user interfaces
http://code.google.com/p/termbox
MIT License
1.96k stars 185 forks source link

Replace waf with Makefile #94

Closed silversquirl closed 7 years ago

silversquirl commented 7 years ago

Using Python to build a C library seems a bit... odd. Makefiles have been around for decades, and work perfectly for both small and large projects.

Makefiles have the advantage of being ubiquitous across UNIX-like systems. Anyone with a C compiler will have make, but a lot of people with C compilers won't have Python, and many of those won't want to install it just to build a single library.

Portability aside, Makefiles are a lot easier for contributors as well as for people who just want to use the library. Almost everyone who knows C can write, or at least understand, a Makefile, making it easier to contribute to projects that use them.


I removed the src and build directories because the root of the repo felt a bit empty with only src, README.rst and COPYING. It's easy enough to add them back in if necessary though, so let me know.

This also resolves issue #93, partly because I wanted to remove all Python code from the repo and partly because I couldn't be bothered to work out how the wrapper is generated and integrate that into the Makefile. Let me know if you'd prefer to keep it in and I'll see what I can do.

silversquirl commented 7 years ago

Another thing to bear in mind is the fact that my two Makefiles have a total SLOC of 32, whereas waf with the 3 wscript files totals 156 lines (waf alone being 106 of those).

rofl0r commented 7 years ago

i applaud you to your sane intentions, but this already happened in the past - followup: https://github.com/nsf/termbox/commit/36574f75b3c6567a72fe74a3306921025d76898d

nsf commented 7 years ago

No.

silversquirl commented 7 years ago

@rofl0r, I see. Why was the Makefile removed, out of interest?

nsf commented 7 years ago

Makefile was contributed by third party. There were multiple build systems. At the moment of removal the only build system I used for my own projects was waf. Now I would use cmake, but for termbox it doesn't matter what build system is used, it should only be used by a person who contributes to termbox (me or whoever). Termbox is a super small library that doesn't need a makefile. You can compile it with a single very small command invoking a compiler directly and I encourage people not to package termbox as a separate library, but embed the source into their own projects instead. The build system in-place I have is used as a convenient way to compile demos, probably I should replace it with a bash script.

Waf or cmake would be a better choice if termbox ever gets a windows port. Which was planned, but I ended up implementing it only in termbox-go. Makefiles on windows are useless.

silversquirl commented 7 years ago

@nsf, gotcha. I think I'll host my Makefile (modified slightly to fit the upstream termbox distribution) in a repo somewhere so I or others can use it in projects which use Makefiles.

What I'm currently doing is adding termbox as a git submodule in libs/termbox, and then copying in my Makefile as libs/termbox.mk. Then, in my project's Makefile, I can run make -C libs -f termbox.mk libtermbox.a to generate a static library which I can then link with my source files. By using git submodules, I ensure that I can still receive the latest updates to termbox and I reduce the amount of copying I have to do.

Once I get around to uploading the Makefile somewhere, would you consider adding it to the README so others can use it?

nsf commented 7 years ago

No.