After this is seems to be using --prefix for make install but not when building. The binaries assume a location of /usr/local. See below for details. How do I build pacman to run from a custom directory?

To make install I run

$make

$sudo mkdir /usr/local/pacman

$sudo chown localuser:localuser /usr/local/pacman/

$make install

At this point it has installed pacman executable at:

$ls /usr/local/pacman/bin/pacman

/usr/local/pacman/bin/pacman

The configuration file can be found at

$ls /usr/local/pacman/etc/pacman.conf

/usr/local/pacman/etc/pacman.conf

However when I run pacman I get an error, like the following:

$ /usr/local/pacman/bin/pacman -U ~/mist.tar.gz

error: config file /usr/local/etc/pacman.conf could not be read: No such file or directory

If I go and link the file:

$sudo ln -s /usr/local/pacman/etc/pacman.conf /usr/local/etc/

Then run pacman again I still get an error, just now with the var folder:

$/usr/local/pacman/bin/pacman -U ~/mist.tar.gz

error: failed to initialize alpm library

(could not find or read directory: /usr/local/var/lib/pacman/)

It seems to be taking the prefix for installation but not for compile. What do I need to change to make it run from a different prefix?

Re: building pacman for a customer foloder

On 07/03/18 12:49, pacman-dev via pacman-dev wrote:

> Hello Pacman Team,
>
>
>
> I was trying to build Pacman for installation into a custom folder.
>
>
>
> I downloaded the following pacman source code:
>
> https://sources.archlinux.org/other/pacman/pacman-5.0.2.tar.gz>
>
>
> I then ran the following configure command:
>
> ./configure --prefix=/usr/local/pacman/ --disable-doc --disable-shared
>
>
>
> After this is seems to be using --prefix for make install but not when building. The binaries assume a location of /usr/local. See below for details. How do I build pacman to run from a custom directory?
>
>

Re: building pacman for a customer foloder

On 03/06/2018 09:49 PM, pacman-dev via pacman-dev wrote:
> It seems to be taking the prefix for installation but not for
> compile. What do I need to change to make it run from a different
> prefix?

Okay, first of all you are using way, way too many blank lines in your
email and that is super distracting, so please fix that in the future.
This is not a college paper, you don't need to double-space everything.

As for the prefix issue, I am honestly not understanding the problem.
You wanted to compile pacman to use a custom installation directory, and
that is *exactly* what pacman did with `--prefix`.

Yes, prefix changes where the pacman binary goes, and it changes where
the libalpm.so library goes... and it also changes where the sysconfdir
and localstatedir go. You are of course entirely free to change the
defaults for those as well, for example to continue using the same
configuration and databases used by the repository package for pacman,
you simply specify `--sysconfdir=/etc --localstatedir=/var`

P.S. these options are pretty standard autotools things, so this is
generic knowledge that will apply across many coding projects. :)

&gt; After this is seems to be using --prefix for make install but not when building. The binaries assume a location of /usr/local. See below for details. How do I build pacman to run from a custom directory?

&gt;

&gt;

Build information:

source code location : .

prefix : /usr/local/pacman

sysconfdir : /usr/local/pacman/etc

conf file : /usr/local/pacman/etc/pacman.conf

localstatedir : /usr/local/pacman/var

database dir : /usr/local/pacman/var/lib/pacman/

cache dir : /usr/local/pacman/var/cache/pacman/pkg/

$ ./src/pacman/pacman

error: config file /usr/local/pacman/etc/pacman.conf could not be read: