You are not logged in.
The way I have handled installation on multiple distros of my homegrown project, psd, is by providing matching Makefiles that correspond to each distro. For example:
Makefile.archlinux
Makefile.fedora
Makefile.ubuntu
The INSTALL file shows users to simply symlink the correct makefile for their distro prior to building, i.e.:
ln -s Makefile.archlinux Makefile && make
This works but isn't very elegant. I am seeking advice for combining these multiple Makefiles into a simplistic method to allow the same functionality. Suggestions are welcomed.
There is an open issue on my github about this. Feel free to comment in this thread or in the issue itself.
Last edited by graysky (2013-06-02 20:29:35)
CPU-optimized Linux-ck packages @ Repo-ck • AUR packages • Zsh and other configs
Offline
You could add a variable like ${DISTRO} or something similar and have it do the specific operations as necessary based on the value of distro, which could then be declared in the make command by the user.
Thoughts?
All the best,
-HG
Offline
I briefly looked at the different Makefiles... What's different in them that causes you to need separate Makefiles? What causes different distributions to need special cases?
I, too, immediately thought "Use GNU Autotools" (or a modern replacement). Is there a reason why you wouldn't?
Offline
Thought of using m4?
You could combine all the subtleties for various distros into one single makefile, run the makefile through the m4 pre-processor for a specific distro. Nice thing about it is that you will just have one makefile to maintain.
Offline
Thought of using m4?
You could combine all the subtleties for various distros into one single makefile, run the makefile through the m4 pre-processor for a specific distro. Nice thing about it is that you will just have one makefile to maintain.
This is a trick question, right? Because I think you just described GNU Autotools...
Offline
digirium wrote:Thought of using m4?
You could combine all the subtleties for various distros into one single makefile, run the makefile through the m4 pre-processor for a specific distro. Nice thing about it is that you will just have one makefile to maintain.
This is a trick question, right? Because I think you just described GNU Autotools...
Ahh I suppose so!
Offline
TARGET = `uname -a`
...
default: ${TARGET}
Arch:
#arch linux specific stuff here
Ubuntoo:
#uboontoo specifics here <note, check the output of uname -a on these systems, I only have arch>
Fedora:
#get it?
Autotools shmatotools. I have one Make file for three different operating systems. Ever notice how many projects that use autotools may only take a second or two to compile, but the damned configure script could take a minute or two to finish.
EDIT: Better yet, combine this with HalosGhost's suggestion so the top would be:
TARGET ?= `uname -a`
Then users who know what they are doing can specify/override the default behavior, but if they just blindly run 'make' it should still work.
Last edited by Trilby (2013-05-31 21:54:11)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
[snip]
Much more elegantly explained. But I'd recommend this solution as opposed to autotools; it's much cleaner imho.
All the best,
-HG
P.S., but `uname -s` or `uname -o` might be better than `uname -a`
Last edited by HalosGhost (2013-05-31 21:54:17)
Offline
Crap ... yes, -n was just a coincidence in my case. I named my computer "Arch". Sorry. But -s and -o are good for determining the os (Linux), not the distro. But /etc/os-release should have it.
TARGET ?= `source /etc/os-release && echo $$NAME`
Last edited by Trilby (2013-05-31 22:12:44)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Good suggestions here, all. Thank you. I am attracted to the simplicity of trilby's suggestion.
Last edited by graysky (2013-05-31 22:23:23)
CPU-optimized Linux-ck packages @ Repo-ck • AUR packages • Zsh and other configs
Offline
See my email reply - I did botch some of the particulars in my initial suggestions - but the concept will work.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
But I'd recommend this solution as opposed to autotools; it's much cleaner imho.
But, but, but, but, what about "make install" to a special location? What about "make uninstall"? What about ensuring that necessary dependencies are installed? What about "make dist" to package up the source code? What about installing on Slackware, FreeBSD, Cygwin, and Haiku?
...It doesn't really matter to me, of course. But I TOTALLY got bitten recently by NOT using THE "standard" for makefiles.
Offline
a makefile can contain include statements and conditional code. So you could include the system specific makefile.
http://www.chemie.fu-berlin.de/chemnet/ … html#SEC15
http://www.chemie.fu-berlin.de/chemnet/ … html#SEC67
Edit: or create your custom ./configure. Who says you have to use autotools? You can put your own shellscript there, and e.g. check dependencies with pkg-config.
Last edited by progandy (2013-06-01 02:38:21)
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |
Offline
Here's what went out via email:
include /etc/os-release
NULL :=
SPACE := ${NULL} ${NULL}
${SPACE} := ${SPACE}
TARGET := $(subst ",,$(subst ${ },_,${NAME}))
default: ${TARGET}
install: ${TARGET}.install
Arch_Linux:
echo "build related stuff here"
Arch_Linux.install:
echo "installation stuff here"
Fedora:
...
Fedora.install:
...
One can have install/uninstall/whatever directives that are different for every distro ... as long as they use os-release. Other OSs don't, but there are simpler methods for detecting the OS.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Firstly, thanks to everyone who relied with suggestions. I don't want to learn autotools/m4 and opted for a simple configure script that will select which Makefile.xxx is needed (supported distros). Changes reside on the unstable branch in commit 7450fae.
Feedback is appreciated.
EDIT: Bah, mine was a dirty hack. This is now solved thanks to a gentoo user/dev. The Makefile he proposed is rather elegant solution. Check it out on the github repo and thank you all who replied.
Last edited by graysky (2013-06-02 20:30:45)
CPU-optimized Linux-ck packages @ Repo-ck • AUR packages • Zsh and other configs
Offline