Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting an environment variable, in recipe.rb, not respected during the configure step. #193

Open
madelaney opened this issue Nov 2, 2017 · 3 comments

Comments

@madelaney
Copy link

I have a recipe in which I want to set a unique value for JAVA_HOME.

I have the following code:

class Package < FPM::Cookery::Recipe
  ...
  def build
    environment['JAVA_HOME'] = '/usr/lib/jvm/openjdk-8-jdk'
    configure 
  end
  ...
end

However, during the configure phase, the build does not see the aforementioned JAVA_HOME value.

@mnikhil-git
Copy link

try env['JAVA_HOME'] ?

@kkaos
Copy link

kkaos commented Aug 16, 2019

I have come across a similar issue. I want to accomplish the following in recipe.rb, especially so that the dl library gets linked when compiling is performed via gcc:

export LIBS="-Wl,--no-as-needed -ldl"

When building the software in question, I run that statement before running configure, make, and then "make install". In my recipe.rb, I have tried both this:

def build
   environment['LIBS'] = '-Wl,--no-as-needed -ldl'
   sh './configure',
      "--prefix=#{prefix}",
      "--with-hdf5=/cm/shared/apps/hdf5_18/current",
      "--enable-64bit=true"
   make "--jobs=#{nproc}"
 end

and this:

 def build
    env['LIBS'] = '-Wl,--no-as-needed -ldl'
    sh './configure',
       "--prefix=#{prefix}",
       "--with-hdf5=/cm/shared/apps/hdf5_18/current",
       "--enable-64bit=true"
    make "--jobs=#{nproc}"
  end

While "environment" is recognized as a valid keyword with fpm-cookery, "env" is not; however, neither accomplishes what the export statement does outside of fpm-cookery, as the dl library never gets linked thereby causing compilation to fail.

@kkaos
Copy link

kkaos commented Sep 6, 2019

Ok, this does the trick:

environment :LIBS => "-Wl,--no-as-needed -ldl"
def build
    environment.with_clean do
       sh './configure',
          "--prefix=#{prefix}",
          "--with-hdf5=/cm/shared/apps/hdf5_18/current",
          "--enable-64bit=true"
       make "--jobs=#{nproc}"
    end
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants