pullup 3232
[pkgsrcv2.git] / mk / fuse.buildlink3.mk
1 # $NetBSD: fuse.buildlink3.mk,v 1.9 2009/03/17 22:13:36 rillig Exp $
2 #
3 # Makefile fragment for packages using the FUSE framework.
4 #
5
6 .if !defined(FUSE_BUILDLINK3_MK)
7 FUSE_BUILDLINK3_MK=     # defined
8
9 .include "bsd.fast.prefs.mk"
10
11 .  if ${OPSYS} == "Darwin"
12
13 .    if !exists(/usr/local/include/fuse.h)
14 PKG_FAIL_REASON+=       "Couldn't find fuse headers; please install MacFUSE."
15 .    endif
16
17 do-configure-pre-hook: override-fuse-pkgconfig
18
19 override-fuse-pkgconfig: override-message-fuse-pkgconfig
20 override-message-fuse-pkgconfig:
21         @${STEP_MSG} "Setting up usage of native MacFUSE."
22
23 override-fuse-pkgconfig:
24         ${RUN}                                          \
25         ${MKDIR} ${BUILDLINK_DIR}/lib/pkgconfig;        \
26         ${LN} -s /usr/local/lib/pkgconfig/fuse.pc       \
27             ${BUILDLINK_DIR}/lib/pkgconfig/fuse.pc
28
29 BUILDLINK_PASSTHRU_DIRS+=       /usr/local/include/fuse
30
31 .  elif ${OPSYS} == "Linux"
32
33 .    include "../../filesystems/fuse/buildlink3.mk"
34
35 .  elif ${OPSYS} == "NetBSD"
36 .     if !exists(/usr/include/fuse.h)
37 PKG_FAIL_REASON+=       "Couldn't find fuse headers, please install librefuse."
38 .     endif
39
40 .    if !empty(USE_TOOLS:C/:.*//:Mpkg-config)
41 do-configure-pre-hook: override-fuse-pkgconfig
42
43 BLKDIR_PKGCFG=  ${BUILDLINK_DIR}/lib/pkgconfig
44 FUSE_PKGCFGF=   fuse.pc
45
46 override-fuse-pkgconfig: override-message-fuse-pkgconfig
47 override-message-fuse-pkgconfig:
48         @${STEP_MSG} "Magical transformations for fuse on NetBSD."
49
50 override-fuse-pkgconfig:
51         ${RUN}                                          \
52         ${MKDIR} ${BLKDIR_PKGCFG};                      \
53         {                                               \
54         ${ECHO} "prefix=/usr";                          \
55         ${ECHO} "exec_prefix=\$${prefix}";              \
56         ${ECHO} "libdir=\$${exec_prefix}/lib";          \
57         ${ECHO} "includedir=\$${prefix}/include";       \
58         ${ECHO} "";                                     \
59         ${ECHO} "Name: FuSE";                           \
60         ${ECHO} "Description: Filesystem USEr Space";   \
61         ${ECHO} "Version: 2.6.0";                       \
62         ${ECHO} "Libs: -Wl,-R\$${libdir} -L\$${libdir} -lrefuse";       \
63         ${ECHO} "Cflags: -I\$${includedir}";            \
64         } >> ${BLKDIR_PKGCFG}/${FUSE_PKGCFGF};
65
66 .    endif # pkg-config
67
68 # To make sure
69 BUILDLINK_TRANSFORM+=   l:fuse:refuse
70
71 # Undefined reference to fuse_main()... use fuse_exit() for now.
72 .    if defined(GNU_CONFIGURE)
73 SUBST_CLASSES+=         refuse
74 SUBST_STAGE.refuse=     pre-configure
75 SUBST_FILES.refuse=     configure
76 .      for _f_ in configure.in configure.ac
77 .        if exists(${WRKSRC}/${_f_})
78 SUBST_FILES.refuse+=    ${_f_}
79 .        endif
80 .      endfor
81 SUBST_SED.refuse=       -e "s|fuse_main|fuse_exit|g"
82 .    endif
83
84 .  else # !NetBSD
85
86 PKG_FAIL_REASON+=       "Your OS is not supported by the FUSE pkgsrc framework."
87
88 .  endif # end of Operating Systems
89
90 .endif # FUSE_BUILDLINK3_MK