Use GCC 4 -fvisibility to control exported symbols.
1.1 --- a/configure.ac Mon Jun 23 14:52:39 2008 -0400
1.2 +++ b/configure.ac Mon Jun 23 17:19:20 2008 -0400
1.3 @@ -103,6 +103,25 @@
1.4 changequote([,])dnl
1.5 fi
1.6
1.7 +
1.8 +# gcc default visibility stuff
1.9 +
1.10 +have_gcc4=no
1.11 +AC_MSG_CHECKING(for -fvisibility)
1.12 +AC_COMPILE_IFELSE([
1.13 +#if defined(__GNUC__) && (__GNUC__ >= 4)
1.14 +#else
1.15 +#error Need GCC 4.0 for visibility
1.16 +#endif
1.17 +int main () { return 0; }
1.18 +], have_gcc4=yes)
1.19 +
1.20 +if test "x$have_gcc4" = "xyes"; then
1.21 + CFLAGS="$CFLAGS -fvisibility=hidden"
1.22 +fi
1.23 +AC_MSG_RESULT($have_gcc4)
1.24 +
1.25 +
1.26 PKG_CHECK_MODULES(CURL, [libcurl])
1.27 AC_SUBST(CURL_CFLAGS)
1.28 AC_SUBST(CURL_LIBS)
2.1 --- a/librazor/importer.c Mon Jun 23 14:52:39 2008 -0400
2.2 +++ b/librazor/importer.c Mon Jun 23 17:19:20 2008 -0400
2.3 @@ -23,7 +23,7 @@
2.4 #include "razor-internal.h"
2.5 #include "razor.h"
2.6
2.7 -void
2.8 +RAZOR_EXPORT void
2.9 razor_importer_begin_package(struct razor_importer *importer,
2.10 const char *name,
2.11 const char *version,
2.12 @@ -42,7 +42,7 @@
2.13 }
2.14
2.15
2.16 -void
2.17 +RAZOR_EXPORT void
2.18 razor_importer_finish_package(struct razor_importer *importer)
2.19 {
2.20 list_set_array(&importer->package->properties,
2.21 @@ -53,7 +53,7 @@
2.22 array_release(&importer->properties);
2.23 }
2.24
2.25 -void
2.26 +RAZOR_EXPORT void
2.27 razor_importer_add_details(struct razor_importer *importer,
2.28 const char *summary,
2.29 const char *description,
2.30 @@ -66,7 +66,7 @@
2.31 importer->package->license = hashtable_tokenize(&importer->details_table, license);
2.32 }
2.33
2.34 -void
2.35 +RAZOR_EXPORT void
2.36 razor_importer_add_property(struct razor_importer *importer,
2.37 const char *name,
2.38 uint32_t flags,
2.39 @@ -92,7 +92,7 @@
2.40 }
2.41 }
2.42
2.43 -void
2.44 +RAZOR_EXPORT void
2.45 razor_importer_add_file(struct razor_importer *importer, const char *name)
2.46 {
2.47 struct import_entry *e;
2.48 @@ -104,7 +104,7 @@
2.49 e->name = strdup(name);
2.50 }
2.51
2.52 -struct razor_importer *
2.53 +RAZOR_EXPORT struct razor_importer *
2.54 razor_importer_create(void)
2.55 {
2.56 struct razor_importer *importer;
2.57 @@ -121,7 +121,7 @@
2.58 }
2.59
2.60 /* Destroy an importer without creating the set. */
2.61 -void
2.62 +RAZOR_EXPORT void
2.63 razor_importer_destroy(struct razor_importer *importer)
2.64 {
2.65 /* FIXME: write this */
2.66 @@ -469,7 +469,7 @@
2.67 free(pkgs);
2.68 }
2.69
2.70 -struct razor_set *
2.71 +RAZOR_EXPORT struct razor_set *
2.72 razor_importer_finish(struct razor_importer *importer)
2.73 {
2.74 struct razor_set *set;
3.1 --- a/librazor/iterator.c Mon Jun 23 14:52:39 2008 -0400
3.2 +++ b/librazor/iterator.c Mon Jun 23 17:19:20 2008 -0400
3.3 @@ -36,7 +36,7 @@
3.4 return pi;
3.5 }
3.6
3.7 -struct razor_package_iterator *
3.8 +RAZOR_EXPORT struct razor_package_iterator *
3.9 razor_package_iterator_create(struct razor_set *set)
3.10 {
3.11 struct razor_package_iterator *pi;
3.12 @@ -49,7 +49,7 @@
3.13 return pi;
3.14 }
3.15
3.16 -void
3.17 +RAZOR_EXPORT void
3.18 razor_package_iterator_init_for_property(struct razor_package_iterator *pi,
3.19 struct razor_set *set,
3.20 struct razor_property *property)
3.21 @@ -59,7 +59,7 @@
3.22 pi->index = list_first(&property->packages, &set->package_pool);
3.23 }
3.24
3.25 -struct razor_package_iterator *
3.26 +RAZOR_EXPORT struct razor_package_iterator *
3.27 razor_package_iterator_create_for_property(struct razor_set *set,
3.28 struct razor_property *property)
3.29 {
3.30 @@ -69,7 +69,7 @@
3.31 return razor_package_iterator_create_with_index(set, index);
3.32 }
3.33
3.34 -struct razor_package_iterator *
3.35 +RAZOR_EXPORT struct razor_package_iterator *
3.36 razor_package_iterator_create_for_file(struct razor_set *set,
3.37 const char *filename)
3.38 {
3.39 @@ -84,7 +84,7 @@
3.40 return razor_package_iterator_create_with_index(set, index);
3.41 }
3.42
3.43 -int
3.44 +RAZOR_EXPORT int
3.45 razor_package_iterator_next(struct razor_package_iterator *pi,
3.46 struct razor_package **package,
3.47 const char **name,
3.48 @@ -119,7 +119,7 @@
3.49 return valid;
3.50 }
3.51
3.52 -void
3.53 +RAZOR_EXPORT void
3.54 razor_package_iterator_destroy(struct razor_package_iterator *pi)
3.55 {
3.56 if (pi->free_index)
3.57 @@ -128,7 +128,7 @@
3.58 free(pi);
3.59 }
3.60
3.61 -struct razor_property_iterator *
3.62 +RAZOR_EXPORT struct razor_property_iterator *
3.63 razor_property_iterator_create(struct razor_set *set,
3.64 struct razor_package *package)
3.65 {
3.66 @@ -148,7 +148,7 @@
3.67 return pi;
3.68 }
3.69
3.70 -int
3.71 +RAZOR_EXPORT int
3.72 razor_property_iterator_next(struct razor_property_iterator *pi,
3.73 struct razor_property **property,
3.74 const char **name,
3.75 @@ -183,7 +183,7 @@
3.76 return valid;
3.77 }
3.78
3.79 -void
3.80 +RAZOR_EXPORT void
3.81 razor_property_iterator_destroy(struct razor_property_iterator *pi)
3.82 {
3.83 free(pi);
3.84 @@ -195,7 +195,7 @@
3.85 int count;
3.86 };
3.87
3.88 -struct razor_package_query *
3.89 +RAZOR_EXPORT struct razor_package_query *
3.90 razor_package_query_create(struct razor_set *set)
3.91 {
3.92 struct razor_package_query *pq;
3.93 @@ -209,7 +209,7 @@
3.94 return pq;
3.95 }
3.96
3.97 -void
3.98 +RAZOR_EXPORT void
3.99 razor_package_query_add_package(struct razor_package_query *pq,
3.100 struct razor_package *p)
3.101 {
3.102 @@ -220,7 +220,7 @@
3.103 pq->vector[p - packages] = 1;
3.104 }
3.105
3.106 -void
3.107 +RAZOR_EXPORT void
3.108 razor_package_query_add_iterator(struct razor_package_query *pq,
3.109 struct razor_package_iterator *pi)
3.110 {
3.111 @@ -234,7 +234,7 @@
3.112 }
3.113 }
3.114
3.115 -struct razor_package_iterator *
3.116 +RAZOR_EXPORT struct razor_package_iterator *
3.117 razor_package_query_finish(struct razor_package_query *pq)
3.118 {
3.119 struct razor_package_iterator *pi;
4.1 --- a/librazor/razor-internal.h Mon Jun 23 14:52:39 2008 -0400
4.2 +++ b/librazor/razor-internal.h Mon Jun 23 17:19:20 2008 -0400
4.3 @@ -4,6 +4,14 @@
4.4 #include <stdlib.h>
4.5 #include <stdint.h>
4.6
4.7 +/* GCC visibility */
4.8 +#if defined(__GNUC__) && __GNUC__ >= 4
4.9 +#define RAZOR_EXPORT __attribute__ ((visibility("default")))
4.10 +#else
4.11 +#define RAZOR_EXPORT
4.12 +#endif
4.13 +
4.14 +
4.15 void *zalloc(size_t size);
4.16
4.17 struct array {
5.1 --- a/librazor/razor.c Mon Jun 23 14:52:39 2008 -0400
5.2 +++ b/librazor/razor.c Mon Jun 23 17:19:20 2008 -0400
5.3 @@ -65,7 +65,7 @@
5.4 { RAZOR_DETAILS_STRING_POOL, offsetof(struct razor_set, details_string_pool) },
5.5 };
5.6
5.7 -struct razor_set *
5.8 +RAZOR_EXPORT struct razor_set *
5.9 razor_set_create(void)
5.10 {
5.11 struct razor_set *set;
5.12 @@ -85,7 +85,7 @@
5.13 return set;
5.14 }
5.15
5.16 -struct razor_set *
5.17 +RAZOR_EXPORT struct razor_set *
5.18 razor_set_open(const char *filename)
5.19 {
5.20 struct razor_set *set;
5.21 @@ -119,7 +119,7 @@
5.22 return set;
5.23 }
5.24
5.25 -void
5.26 +RAZOR_EXPORT void
5.27 razor_set_open_details(struct razor_set *set, const char *filename)
5.28 {
5.29 struct razor_set_section *s;
5.30 @@ -147,7 +147,7 @@
5.31 close(fd);
5.32 }
5.33
5.34 -void
5.35 +RAZOR_EXPORT void
5.36 razor_set_open_files(struct razor_set *set, const char *filename)
5.37 {
5.38 struct razor_set_section *s;
5.39 @@ -175,7 +175,7 @@
5.40 close(fd);
5.41 }
5.42
5.43 -void
5.44 +RAZOR_EXPORT void
5.45 razor_set_destroy(struct razor_set *set)
5.46 {
5.47 unsigned int size;
5.48 @@ -264,7 +264,7 @@
5.49 return 0;
5.50 }
5.51
5.52 -int
5.53 +RAZOR_EXPORT int
5.54 razor_set_write_to_fd(struct razor_set *set, int fd,
5.55 enum razor_repo_file_type type)
5.56 {
5.57 @@ -287,7 +287,7 @@
5.58 }
5.59 }
5.60
5.61 -int
5.62 +RAZOR_EXPORT int
5.63 razor_set_write(struct razor_set *set, const char *filename,
5.64 enum razor_repo_file_type type)
5.65 {
5.66 @@ -305,7 +305,8 @@
5.67
5.68 return close(fd);
5.69 }
5.70 -void
5.71 +
5.72 +RAZOR_EXPORT void
5.73 razor_build_evr(char *evr_buf, int size, const char *epoch,
5.74 const char *version, const char *release)
5.75 {
5.76 @@ -328,7 +329,7 @@
5.77 snprintf(evr_buf, size, "-%s", release);
5.78 }
5.79
5.80 -int
5.81 +RAZOR_EXPORT int
5.82 razor_versioncmp(const char *s1, const char *s2)
5.83 {
5.84 const char *p1, *p2;
5.85 @@ -365,7 +366,7 @@
5.86 return *p1 - *p2;
5.87 }
5.88
5.89 -struct razor_package *
5.90 +RAZOR_EXPORT struct razor_package *
5.91 razor_set_get_package(struct razor_set *set, const char *package)
5.92 {
5.93 struct razor_package_iterator *pi;
5.94 @@ -382,8 +383,9 @@
5.95 return p;
5.96 }
5.97
5.98 -void
5.99 -razor_package_get_details(struct razor_set *set, struct razor_package *package,
5.100 +RAZOR_EXPORT void
5.101 +razor_package_get_details(struct razor_set *set,
5.102 + struct razor_package *package,
5.103 const char **summary, const char **description,
5.104 const char **url, const char **license)
5.105 {
5.106 @@ -395,7 +397,7 @@
5.107 *license = &pool[package->license];
5.108 }
5.109
5.110 -struct razor_entry *
5.111 +RAZOR_EXPORT struct razor_entry *
5.112 razor_set_find_entry(struct razor_set *set,
5.113 struct razor_entry *dir, const char *pattern)
5.114 {
5.115 @@ -441,7 +443,7 @@
5.116 } while (!((e++)->flags & RAZOR_ENTRY_LAST));
5.117 }
5.118
5.119 -void
5.120 +RAZOR_EXPORT void
5.121 razor_set_list_files(struct razor_set *set, const char *pattern)
5.122 {
5.123 struct razor_entry *e;
5.124 @@ -526,7 +528,7 @@
5.125 return r;
5.126 }
5.127
5.128 -void
5.129 +RAZOR_EXPORT void
5.130 razor_set_list_package_files(struct razor_set *set, const char *name)
5.131 {
5.132 struct razor_package *package;
5.133 @@ -547,7 +549,7 @@
5.134 * requires for a package have been installed before the package.
5.135 **/
5.136
5.137 -void
5.138 +RAZOR_EXPORT void
5.139 razor_set_diff(struct razor_set *set, struct razor_set *upstream,
5.140 razor_diff_callback_t callback, void *data)
5.141 {
5.142 @@ -602,7 +604,7 @@
5.143 razor_package_query_add_package(data, package);
5.144 }
5.145
5.146 -struct razor_package_iterator *
5.147 +RAZOR_EXPORT struct razor_package_iterator *
5.148 razor_set_create_remove_iterator(struct razor_set *set,
5.149 struct razor_set *next)
5.150 {
5.151 @@ -622,7 +624,7 @@
5.152 return pi;
5.153 }
5.154
5.155 -struct razor_package_iterator *
5.156 +RAZOR_EXPORT struct razor_package_iterator *
5.157 razor_set_create_install_iterator(struct razor_set *set,
5.158 struct razor_set *next)
5.159 {
6.1 --- a/librazor/root.c Mon Jun 23 14:52:39 2008 -0400
6.2 +++ b/librazor/root.c Mon Jun 23 17:19:20 2008 -0400
6.3 @@ -20,7 +20,7 @@
6.4 char new_path[PATH_MAX];
6.5 };
6.6
6.7 -int
6.8 +RAZOR_EXPORT int
6.9 razor_root_create(const char *root)
6.10 {
6.11 struct stat buf;
6.12 @@ -67,7 +67,7 @@
6.13 return 0;
6.14 }
6.15
6.16 -struct razor_root *
6.17 +RAZOR_EXPORT struct razor_root *
6.18 razor_root_open(const char *root)
6.19 {
6.20 struct razor_root *image;
6.21 @@ -107,7 +107,7 @@
6.22 return image;
6.23 }
6.24
6.25 -struct razor_set *
6.26 +RAZOR_EXPORT struct razor_set *
6.27 razor_root_open_read_only(const char *root)
6.28 {
6.29 char path[PATH_MAX];
6.30 @@ -118,13 +118,13 @@
6.31 return razor_set_open(path);
6.32 }
6.33
6.34 -struct razor_set *
6.35 +RAZOR_EXPORT struct razor_set *
6.36 razor_root_get_system_set(struct razor_root *root)
6.37 {
6.38 return root->system;
6.39 }
6.40
6.41 -int
6.42 +RAZOR_EXPORT int
6.43 razor_root_close(struct razor_root *root)
6.44 {
6.45 razor_set_destroy(root->system);
6.46 @@ -135,7 +135,7 @@
6.47 return 0;
6.48 }
6.49
6.50 -void
6.51 +RAZOR_EXPORT void
6.52 razor_root_update(struct razor_root *root, struct razor_set *next)
6.53 {
6.54 razor_set_write_to_fd(next, root->fd, RAZOR_REPO_FILE_MAIN);
6.55 @@ -147,7 +147,7 @@
6.56 printf("wrote %s\n", root->new_path);
6.57 }
6.58
6.59 -int
6.60 +RAZOR_EXPORT int
6.61 razor_root_commit(struct razor_root *root)
6.62 {
6.63 /* Make it so. */
7.1 --- a/librazor/rpm.c Mon Jun 23 14:52:39 2008 -0400
7.2 +++ b/librazor/rpm.c Mon Jun 23 17:19:20 2008 -0400
7.3 @@ -347,7 +347,7 @@
7.4 }
7.5 }
7.6
7.7 -struct razor_rpm *
7.8 +RAZOR_EXPORT struct razor_rpm *
7.9 razor_rpm_open(const char *filename)
7.10 {
7.11 struct razor_rpm *rpm;
7.12 @@ -703,7 +703,7 @@
7.13 return l;
7.14 }
7.15
7.16 -int
7.17 +RAZOR_EXPORT int
7.18 razor_rpm_install(struct razor_rpm *rpm, const char *root)
7.19 {
7.20 struct installer installer;
7.21 @@ -766,7 +766,7 @@
7.22 return 0;
7.23 }
7.24
7.25 -int
7.26 +RAZOR_EXPORT int
7.27 razor_rpm_close(struct razor_rpm *rpm)
7.28 {
7.29 int err;
7.30 @@ -778,7 +778,7 @@
7.31 return err;
7.32 }
7.33
7.34 -int
7.35 +RAZOR_EXPORT int
7.36 razor_importer_add_rpm(struct razor_importer *importer, struct razor_rpm *rpm)
7.37 {
7.38 const char *name, *version, *release, *arch, *summary;
8.1 --- a/librazor/transaction.c Mon Jun 23 14:52:39 2008 -0400
8.2 +++ b/librazor/transaction.c Mon Jun 23 17:19:20 2008 -0400
8.3 @@ -165,7 +165,7 @@
8.4 }
8.5 }
8.6
8.7 -struct razor_transaction *
8.8 +RAZOR_EXPORT struct razor_transaction *
8.9 razor_transaction_create(struct razor_set *system, struct razor_set *upstream)
8.10 {
8.11 struct razor_transaction *trans;
8.12 @@ -184,7 +184,7 @@
8.13 return trans;
8.14 }
8.15
8.16 -void
8.17 +RAZOR_EXPORT void
8.18 razor_transaction_install_package(struct razor_transaction *trans,
8.19 struct razor_package *package)
8.20 {
8.21 @@ -192,7 +192,7 @@
8.22 trans->changes++;
8.23 }
8.24
8.25 -void
8.26 +RAZOR_EXPORT void
8.27 razor_transaction_remove_package(struct razor_transaction *trans,
8.28 struct razor_package *package)
8.29 {
8.30 @@ -200,7 +200,7 @@
8.31 trans->changes++;
8.32 }
8.33
8.34 -void
8.35 +RAZOR_EXPORT void
8.36 razor_transaction_update_package(struct razor_transaction *trans,
8.37 struct razor_package *package)
8.38 {
8.39 @@ -461,7 +461,7 @@
8.40 }
8.41 }
8.42
8.43 -const char *
8.44 +RAZOR_EXPORT const char *
8.45 razor_property_relation_to_string(struct razor_property *p)
8.46 {
8.47 switch (p->flags & RAZOR_PROPERTY_RELATION_MASK) {
8.48 @@ -485,7 +485,7 @@
8.49 }
8.50 }
8.51
8.52 -const char *
8.53 +RAZOR_EXPORT const char *
8.54 razor_property_type_to_string(struct razor_property *p)
8.55 {
8.56 switch (p->flags & RAZOR_PROPERTY_TYPE_MASK) {
8.57 @@ -567,7 +567,7 @@
8.58 }
8.59 }
8.60
8.61 -void
8.62 +RAZOR_EXPORT void
8.63 razor_transaction_update_all(struct razor_transaction *trans)
8.64 {
8.65 struct razor_package *p;
8.66 @@ -740,7 +740,7 @@
8.67 }
8.68 }
8.69
8.70 -int
8.71 +RAZOR_EXPORT int
8.72 razor_transaction_resolve(struct razor_transaction *trans)
8.73 {
8.74 int last = 0;
8.75 @@ -789,7 +789,7 @@
8.76 }
8.77 }
8.78
8.79 -int
8.80 +RAZOR_EXPORT int
8.81 razor_transaction_describe(struct razor_transaction *trans)
8.82 {
8.83 struct prop_iter rpi;
8.84 @@ -820,7 +820,7 @@
8.85 return unsatisfied;
8.86 }
8.87
8.88 -int
8.89 +RAZOR_EXPORT int
8.90 razor_transaction_unsatisfied_property(struct razor_transaction *trans,
8.91 const char *name,
8.92 uint32_t flags,
8.93 @@ -852,7 +852,7 @@
8.94 return 0;
8.95 }
8.96
8.97 -struct razor_set *
8.98 +RAZOR_EXPORT struct razor_set *
8.99 razor_transaction_finish(struct razor_transaction *trans)
8.100 {
8.101 struct razor_merger *merger;
8.102 @@ -905,7 +905,7 @@
8.103 return razor_merger_finish(merger);
8.104 }
8.105
8.106 -void
8.107 +RAZOR_EXPORT void
8.108 razor_transaction_destroy(struct razor_transaction *trans)
8.109 {
8.110 transaction_set_release(&trans->system);