Creating a MacPorts Portfile for a SCons Project - macports

I want to write a MacPorts Port file for a program typically being installed using SCons.
Usually, I install it by
scons build
scons install
I managed to create a Portfile which fetches the program and builds it correctly by setting the following flags:
depends_build port:scons
use_configure no
build.cmd ${prefix}/bin/scons build
build.target
build.args prefix=${prefix} \
CC=${configure.cc} \
CXX=${configure.cxx}
This compiles everything nicely in the build/ subdirectory.
What is the best way to destroot it? Can I make use of the scons install routine?

There is probably no general way to do this.
In my case, I ended up doing it by installing the program into the $destroot using scons and turning off the usual destroot phase:
depends_build port:scons
use_configure no
build.cmd ${prefix}/bin/scons install
build.target
build.args prefix=${prefix} \
CC=${configure.cc} \
CXX=${configure.cxx} \
python_prefix=${python.prefix} \
stage_dir=$destroot
destroot {}

Related

How to install FFTW-2.1.5 on an M1 MacBook Pro?

I'm trying to install fftw-2.1.5 as it is required by the GADGET3 code version I need to use. I had no issues building it on my Linux machine (running Ubuntu 22.04), but on my M1 MacBook Pro (running macOS Monterey 12.4) it crashes at the configure step.
Running:
./configure --prefix=path/to/local/install \
--enable-mpi \
--enable-type-prefix \
--with-gcc
I got the following error message:
checking build system type... configure: error: /bin/sh ./config.sub -apple-darwin21.5.0 failed
It seems that the configure script is not properly parsing the details of the MacBook, hence it crashes before testing the rest of the dependencies...
Disclaimer: I am fairly new to macOS and I have never had to use autotools before.
I found a similar issue here, so credits to the people that documented it there. I am unsure if all the following steps are required but they certainly solved my issue:
I renamed configure.in to configure.ac
I downloaded and applied all the patches from this website. I simply copied the text of each patch into new files patch_filename and ran $ patch < patch_filename in the main fftw-2.1.5 directory. As I renamed configure.in to configure.ac, when applying patch 05_ac_define_syntax.diff it will prompt the user to specify the path to the file to patch, i.e. configure.ac.
(OPTIONAL) I also needed OpenMP support so additionally I needed to modify lines 249, 251, 253, 255 and 257 so that the variables omp_enabler and CFLAGS read as omp_enabler="$CC -fopenmp" and CFLAGS="$save_CFLAGS -fopenmp", where CC=gcc in my case.
I ran $ autoupdate followed by $ autoreconf -vfi in the main fftw-2.1.5 directory.
I ran the configure script with the desired flags, e.g. for double precision + MPI support:
$ ./configure --prefix=path/to/local/install \
--enable-mpi \
--enable-type-prefix \
--with-gcc \
LDFLAGS=-L/opt/homebrew/lib \
CFLAGS=-I/opt/hombrew/include
Finally, the standard make into make check and make install did the trick

error when compiling testfiles from installed c-algorithms library

I'm trying to install and test c library c-algorithms from Github.
https://github.com/fragglet/c-algorithms/blob/master/test/test-queue.c
When I try to test the installation from the generated test folder with:
gcc -o test-arraylist `pkg-config --cflags --libs libcalg-1.0` test-arraylist.c
I get the following error massage:
test-arraylist.c:30:23: fatal error: arraylist.h: No such file or directory
compilation terminated.
I use a Vagrant box: ubuntu/xenial32 with Ubuntu 14.04.5 LTS
Prior to installation of c-algorithms:
sudo apt-get install autoconf
sudo apt-get install libtool
sudo apt-get install pkg-config
To install the library I have done following:
sudo ./autogen.sh
sudo ./configure
sudo make
sudo make install
Any help would be highly apriciated
The test-arraylist.c has line #include "arraylist.h" but it is under the libcalg subdirectory not directly in the include path.
libcalg subdir should be added to the include path or you have to modify the include like #include "libcalg/arraylist.h"
If you want only run the tests, then run the
sudo make check from the build root (in your case it is the source root)
This is probably going to be stomped on by process-fetishizers.
But.
When you build in a Unix/Linux operating system (and derivatives like RTEMS), you are building off other people's libraries - so you need those libraries and their header files ( just like c-alg... ) installed in locations that your compiler can find.
To find a file that is associated with a package, use dpkg as explained here:
https://askubuntu.com/questions/481/how-do-i-find-the-package-that-provides-a-file
But you have another problem you might not be aware of. You are trying to compile a test program using a gcc command when the software uses GNU autoconf automake and probably libtool to function PROPERLY.
Perhaps you don't understand you need to make sure autoconf, automake, and then libtool find the right configuration from one directory system to another. Fedora puts files in differing spots from Ubuntu distros.
Instead run:
autoreconf -fvi
first in the top level directory and see if this finds your header file.
THEN you run
./configure
and then
make test/check
(whichever it uses, some use recipe "all-tests", etc.)
make all
This would make all if your system is ready to handle them.

How to install cjson properly in Ubuntu 14.0LTS?

I am new in json and I don't know how to use but I found compare to XML json is better so, I am learning json in C programming in Ubuntu 14.0LTS.
I followed https://linuxprograms.wordpress.com/2010/05/20/install-json-c-in-linux/.
In this link, I installed libjson0 with the help of first command but when I installed libjson – debug symbols package with the help of second command which is mentioned in link then showing "E: Unable to locate package libjson0-dbg".
Also I gone through https://github.com/json-c/json-c. After cloning moved to json-c directory, in json-c directory I did sh autogen.sh then showing "autogen.sh: 2: autogen.sh: autoreconf: not found".
Why autoreconf is not works ? When I installed CppUTest and other stuffs then it works.
I also install build-essential which found in google for above problems but it can't works for me.
How can I installed cjson in a proper manner and how to use with the C-programms.
Try below commands:
$ sudo apt-get install libjson-glib-1.0-0 libjson-glib-1.0-0-dev
If you want to debug your programs and see the various steps of serializing/deserializing you can also install the libjson-glib – debug symbols package
$ sudo apt-get install libjson-glib-1.0-0-dbg
For documentation related to json-glib, you must install the following package
$ sudo apt-get install libjson-glib-1.0-0-doc
This documentation will then be available in file:///usr/share/gtk-doc/html/json-glib/index.html
Maybe your problem is related with the path.
The library is installed correctlly but you have tot tell the system where. Here a post on how to do it in Ubuntu How to set the environmental variable LD_LIBRARY_PATH in linux

Installing gcc manually redhat

I am working on a system on which I am a non-root user.
While trying to install gcc 5.1 in a custom directory as the present shared version of gcc isn't working for postgresql installation, I started out by
wget gcc 5.1.
After unzipping the folder, ran the commands below:
cd /seq/genome_portal/lib
mkdir bld
mkdir gcc
cd bld
/seq/genome_portal/lib/gcc-5.1/configure --prefix=/seq/genome_portal/lib/gcc
However config.log still shows this error:
/../../redhat_6_x86_64/pkgs/gcc_4.9.0/libexec/gcc/x86_64-redhat-linux/4.9.0/cc1: error while loading shared libraries: libmpfr.so.4: cannot open shared object file: No such file or directory
The prerequisites that come after
./contrib/download_prerequisites
are gmp,mpfr and mpc. I started with gmp and ended up in the same error as above. I somehow need to tell these programs that I do not want to use the existing gcc.
But I get the same error as mentioned before. Any advice as to how I can proceed to install it?
Building a compiler is much more complicated that building a straightforward utility; just running configure is not enough.
Primarily, you need to read the instructions; they are provided in the GCC source directory in the INSTALL subdirectory. They are in HTML so point your browser at it.
I know you didn't do this yet because the step on configuration makes very clear you should be using an out-of-source configuration; e.g., something like:
mkdir ../bld
cd ../bld
../gcc-5.1/configure ...
rather than running ./configure.
Regarding the missing dependencies, there's a "prerequisites" section in the docs. To get MPFR and other helpful things you can run:
cd gcc-5.1
./contrib/download_prerequisites
ETA: This should work:
rm -rf newgcc
mkdir newgcc
cd newgcc
tar xzf gcc-5.1.tar.gz
cd gcc-5.1
./contrib/download_prerequisites
mkdir ../bld
cd ../bld
../gcc-5.1/configure <configopts>
make -j8
make install
(or whatever -j you prefer).

how do i compile the sshfs file system on a mac?

I downloaded and installed FUSE for osx package.
I downloaded sshfs for mac and successfully installed it on my mac running OSX 10.6.8.
However, at some point, I would like to make some changes to sshfs the source code.
Following is what I tried to build sshfs:
git clone https://github.com/osxfuse/sshfs.git
cd sshfs
autoconf
chmod +x configure
./configure
configure: error: cannot find install-sh or install.sh in "." "./.." "./../.."
I am stuck and not sure how to fix this. Looking at the git repository there is no find that is install-sh or install.sh
I don't know much about autotools, but I think you need to run more commands than just autoconf. Try this sequence:
aclocal
autoconf
autoheader
automake --foreign --add-missing --copy
./configure
make
sudo make install

Resources