Skip to content

Commit ff9f1f4

Browse files
committed
Hardcode library path when building plugins
Needed to resolve shared libsass library.
1 parent d904906 commit ff9f1f4

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

Makefile.PL

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -526,11 +526,16 @@ sub compile_lib {
526526
if ($^O eq 'MSWin32' && $Config{cc} =~ /^cl/) {
527527
die "plugins are not available under MSVC";
528528
}
529-
elsif ($^O eq 'MSWin32' && $Config{cc} =~ /^gcc/) {
529+
elsif ($^O eq 'MSWin32' && $Config{cc} =~ /gcc/) {
530530
push @args, "-Wl,--out-implib,${name}.a";
531531
push @args, '-Wl,--major-image-version,0.0.9';
532532
push @args, '-Wl,--minor-image-version,0.0.9';
533533
}
534+
# add explicit path to libsass lib
535+
# needed to resolve lib from plugins
536+
unless ($^O eq 'MSWin32' && $Config{cc} =~ /^cl/) {
537+
push @args, '-Wl,-rpath,$(INSTALLARCHLIB)';
538+
}
534539
# -static-libgcc -static-libstdc++
535540
return join(' ', @args, @libs);
536541
}
@@ -552,9 +557,10 @@ sub libsass_sassc
552557
else {
553558
# create the sassc executable by linking against sassc and libsass
554559
push @ret, "\t" . '$(LD) -o $(SASSC_EXE) $(LDFLAGS) $(SASSC_OBJ) $(LIBS)'
555-
. ' ' . ($static ? '$(LIBSASS_OBJ)' : '-L$(INST_LIB) -lsass')
560+
. ' ' . ($static ? '$(LIBSASS_OBJ)' : '-L$(INST_ARCHLIB) -lsass')
556561
. ' $(OPTIMIZE) -lstdc++ -std=c++0x ' . join(" ", @libs)
557-
. ($^O eq "linux" ? ' -ldl' : '');
562+
. ($^O eq "linux" ? ' -ldl' : '')
563+
. ' -Wl,-rpath,$(INSTALLARCHLIB)';
558564
}
559565
# add target to virtual "pure_all"
560566
push @cleanups, '$(SASSC_OBJ)';
@@ -569,7 +575,7 @@ sub libsass_lib
569575
# register our source and object files
570576
my @ret = 'LIBSASS_OBJ = ' . join(" ", @SOURCES);
571577
# location of the created object
572-
push @ret, 'LIBSASS_LIB = $(INST_LIB)/libsass.$(SO)';
578+
push @ret, 'LIBSASS_LIB = $(INST_ARCHLIB)/libsass.$(SO)';
573579
# create the target for the makefile
574580
push @ret, '$(LIBSASS_LIB): $(LIBSASS_OBJ)';
575581
# create the libsass shared library by linking against all objects
@@ -593,7 +599,7 @@ sub libsass_plugin_math
593599
push @ret, "\t" . '$(MKPATH) $(INST_ARCHAUTODIR)/plugins/math';
594600
# create the libsass shared library by linking against all objects
595601
push @ret, "\t" . compile_lib('$(MATH_LIB)') . ' $(MATH_OBJ)'
596-
. ' ' . ($static ? '$(LIBSASS_OBJ)' : '-L$(INST_LIB) -lsass');
602+
. ' ' . ($static ? '$(LIBSASS_OBJ)' : '-L$(INST_ARCHLIB) -lsass');
597603
# add target to virtual "pure_all"
598604
push @cleanups, '$(MATH_OBJ)';
599605
push @cleanups, '$(MATH_LIB)';
@@ -613,7 +619,7 @@ sub libsass_plugin_img_size
613619
push @ret, "\t" . '$(MKPATH) $(INST_ARCHAUTODIR)/plugins/img-size';
614620
# create the libsass shared library by linking against all objects
615621
push @ret, "\t" . compile_lib('$(IMG_SIZE_LIB)') . ' $(IMG_SIZE_OBJ)'
616-
. ' ' . ($static ? '$(LIBSASS_OBJ)' : '-L$(INST_LIB) -lsass');
622+
. ' ' . ($static ? '$(LIBSASS_OBJ)' : '-L$(INST_ARCHLIB) -lsass');
617623
# add target to virtual "pure_all"
618624
push @cleanups, '$(IMG_SIZE_OBJ)';
619625
push @cleanups, '$(IMG_SIZE_LIB)';
@@ -638,7 +644,7 @@ sub libsass_plugin_digest
638644
push @ret, "\t" . '$(MKPATH) $(INST_ARCHAUTODIR)/plugins/digest';
639645
# create the libsass shared library by linking against all objects
640646
push @ret, "\t" . compile_lib('$(DIGEST_LIB)') . ' $(DIGEST_OBJ)'
641-
. ' ' . ($static ? '$(LIBSASS_OBJ)' : '-L$(INST_LIB) -lsass');
647+
. ' ' . ($static ? '$(LIBSASS_OBJ)' : '-L$(INST_ARCHLIB) -lsass');
642648
# add target to virtual "pure_all"
643649
push @cleanups, '$(DIGEST_OBJ)';
644650
push @cleanups, '$(DIGEST_LIB)';
@@ -663,7 +669,7 @@ sub libsass_plugin_glob
663669
push @ret, "\t" . '$(MKPATH) $(INST_ARCHAUTODIR)/plugins/glob';
664670
# create the libsass shared library by linking against all objects
665671
push @ret, "\t" . compile_lib('$(GLOB_LIB)') . ' $(GLOB_OBJ)'
666-
. ' ' . ($static ? '$(LIBSASS_OBJ)' : '-L$(INST_LIB) -lsass');
672+
. ' ' . ($static ? '$(LIBSASS_OBJ)' : '-L$(INST_ARCHLIB) -lsass');
667673
# add target to virtual "pure_all"
668674
push @cleanups, '$(GLOB_OBJ)';
669675
push @cleanups, '$(GLOB_LIB)';

0 commit comments

Comments
 (0)