1 |
On Feb 14, 2006, at 9:53 PM, Nick Dimiduk wrote: |
2 |
|
3 |
> Nick Dimiduk wrote: |
4 |
>> Kito wrote: |
5 |
>>> On Feb 1, 2006, at 4:06 PM, Dirk Schönberger wrote: |
6 |
>>>> would it be possible / feasible, that Gentoo creates and uses |
7 |
>>>> Frameworks for |
8 |
>>>> its libraries? |
9 |
>>> |
10 |
>>> Its possible, feasible and highly desired! Has been on my TODO |
11 |
>>> list for over a year now..... |
12 |
>> Will anyone be upset if I take a stab at this (frameworks feature) |
13 |
>> this week? |
14 |
> |
15 |
> |
16 |
> OK. This is my first stab at an ebuild for creating frameworks. |
17 |
|
18 |
Cool, thanks for hacking on this =) |
19 |
|
20 |
> ECLASS="BPFramework" |
21 |
> INHERITED="$INHERITED $ECLASS" |
22 |
|
23 |
I would probably just use 'frameworks' as the name, the 'BP' prefix |
24 |
is not generally used. |
25 |
|
26 |
> |
27 |
> local fw = "${PN}.framework" |
28 |
> |
29 |
> # install_framework: install a framework into the appropriate |
30 |
> directory. |
31 |
> # usage: install_framework file [<new file>] |
32 |
> # ie. install_framework "${PN}.framework" |
33 |
> install_framework() { |
34 |
> [[ -z "${1}" ]] && die "usage: install_framework <file> [<new file>]" |
35 |
> if useq ppc-macos ; then |
36 |
> insinto /Library/Frameworks |
37 |
> newins "$1" "${2:-${1}}" || die "Failed to install ${1}" |
38 |
> fi |
39 |
> } |
40 |
|
41 |
This wouldn't work as it isn't respecting ${D}. You want to have the |
42 |
package install itself to ${D} and let portage handle touching the |
43 |
live fs. |
44 |
|
45 |
> |
46 |
> # create_framework: create the basic framework structure |
47 |
> # usage: create_framework |
48 |
> create_framework() { |
49 |
> if useq ppc-macos ; then |
50 |
> dodir "${fw}/Versions/${PV}/{Headers,${PN},Resources}" |
51 |
> dosym "${fw}/Versions/${PV}/Headers" "${fw}/Headers" |
52 |
> # dosym "${fw}/Versions/${PV}/${PN}" "${fw}/${PN}" |
53 |
> dosym "${fw}/Versions/${PV}/Resources" "${fw}/Resources" |
54 |
> dosym "${fw}/Versions/${PV}" "${fw}/Versions/Current" |
55 |
> fi |
56 |
> } |
57 |
|
58 |
Hmmm, I wonder if we could make use of alternatives.eclass to handle |
59 |
the symlinks for 'Current' |
60 |
|
61 |
> |
62 |
> # insert_binary: insert a compiled file into the framework |
63 |
> # usage: insert_binary <file> [...] |
64 |
> insert_binary() { |
65 |
> [[ -z "${1}" ]] && die "usage: insert_binary <file> [...]" |
66 |
> if useq ppc-macos ; then |
67 |
> into "${fw}/Versions/${PV}" |
68 |
> insopts "-m0755" |
69 |
> while [ -n ${1} ] ; do |
70 |
> doins ${1} |
71 |
> dosym "${fw}/Versions/${PV}/${1}" "${fw}/${1}" |
72 |
> shift |
73 |
> done |
74 |
> fi |
75 |
> } |
76 |
|
77 |
Probably shouldn't use `useq` or `ppc-macos` anymore. In fact, I'm |
78 |
not even sure these need a conditional...but if they do, we should |
79 |
probably `use userland_Darwin` instead. |
80 |
|
81 |
> |
82 |
> # insert_header: insert a header file into the framework |
83 |
> # usage: insert_header <file.h> [...] |
84 |
> insert_header() { |
85 |
> [[ -z "${1}" ]] && die "usage: insert_header <file.h> [...]" |
86 |
> if useq ppc-macos ; then |
87 |
> into "${fw}/Versions/${PV}/Headers" |
88 |
> while [ -n ${1} ] ; do |
89 |
> doins ${1} |
90 |
> shift |
91 |
> done |
92 |
> fi |
93 |
> } |
94 |
> |
95 |
> # insert_resource: insert a resource into the framework |
96 |
> # usage: insert_resource <file> [...] |
97 |
> insert_resource() { |
98 |
> [[ -z "${1}" ]] && die "usage: insert_resource [...]" |
99 |
> if useq ppc-macos ; then |
100 |
> into "${fw}/Versions/${PV}/Resources" |
101 |
> while [ -n ${1} ] ; do |
102 |
> doins ${1} |
103 |
> shift |
104 |
> done |
105 |
> fi |
106 |
> } |
107 |
|
108 |
The insert functions are useful, but I was also picturing a custom |
109 |
src_install that automagically shuffled the files around in ${D} to |
110 |
match the framework structure. For instance, check out some of your |
111 |
existing frameworks of opensource projects like python, perl, and |
112 |
SDL. You'll see they have somewhat of a standard unix-y layout ('./usr |
113 |
{bin,lib,shared}') usually with symlinks like `Documentation- |
114 |
>Versions/Current/usr/share/doc Headers->Versions/Current/usr/include`. |
115 |
|
116 |
The harder problem is how to handle shared objects. Usually a |
117 |
framework builds its shared lib as MyFramework.framework/Versions/ |
118 |
Current/MyFramework and symlinks it to MyFramework.framework/ |
119 |
MyFramework. So in a typical single dylib package, you would mv/ |
120 |
rename the actual dylib file, then set its install_name using |
121 |
install_name_tool(1) to match the new location/destination and fix |
122 |
any paths to linked libs as needed. |
123 |
|
124 |
An even harder problem than that, is allowing packages to depend on |
125 |
portage-built frameworks. Could perhaps abuse built_with_use |
126 |
something like: |
127 |
|
128 |
if built_with_use sys-libs/foo framework; then |
129 |
append-flags "-FFoo" |
130 |
fi |
131 |
|
132 |
Not the best solution, but something that needs to be solved |
133 |
eventually... |
134 |
|
135 |
Again, thanks for working on this, good job! |
136 |
|
137 |
--Kito |
138 |
|
139 |
|
140 |
|
141 |
|
142 |
|
143 |
-- |
144 |
gentoo-osx@g.o mailing list |