SPEC %files attribute and Shell variables

Unfortunately, anything defined in the shell started by the %prep, %build or %install sections isn't preserved in the build environment. You'd need to define %{AXIS2_C}, a MACRO variable (not a shell variable):

%define AXIS2_C /usr/local/something

and then refer to it in both your shells as

make whatever FOO=%{AXIS2_C} # or however you used the env variable

and then in the %files section, use


Usually, the initial %define is at the top of the spec file, with some documentation about what it is for. If you need to dynamically set the macro, you'll have to use more complex RPM spec macro commands like %() to do shell expansions.