GIR: Remove aliases since `shared-library` is passed along correctly now
Signed-off-by: Felicitas Pojtinger <felicitas@pojtinger.com>
- commit
- 21809748623b0c9e543b01d43767aad5df201934
- author
- Felicitas Pojtinger · · 2025-10-17 06:10 UTC
- committer
- Jeroen Wijenbergh · · 2025-10-22 07:42 UTC
- parent
- 2fa804a
- signature
- unsigned
2 files · +13 -29
M internal/core/core.go +0 -16
| @@ -53,13 +53,6 @@ var names = map[string][]string{ | |||
| 53 | 53 | "PANGOCAIRO": {"libpangocairo-1.0.so"}, | |
| 54 | 54 | } | |
| 55 | 55 | ||
| 56 | - | // aliases are lib aliases | |
| 57 | - | // for example when we load the GSK lib, we should get the functions from the GTK shared library | |
| 58 | - | var aliases = map[string]string{ | |
| 59 | - | "GSK": "GTK", | |
| 60 | - | "GDK": "GTK", | |
| 61 | - | } | |
| 62 | - | ||
| 63 | 56 | // pkgConfNames is a lookup from library names to pkg-config library names | |
| 64 | 57 | // This is populated dynamically via SetPackageName and has defaults for common libraries | |
| 65 | 58 | var pkgConfNames = map[string]string{ | |
| @@ -147,10 +140,6 @@ func findPkgConf(name string) string { | |||
| 147 | 140 | // TODO: Hardcore a library shared object with linker -X flag | |
| 148 | 141 | // This is useful for packaging | |
| 149 | 142 | func GetPath(name string) string { | |
| 150 | - | // resolve alias | |
| 151 | - | if v, ok := aliases[name]; ok { | |
| 152 | - | name = v | |
| 153 | - | } | |
| 154 | 143 | // try to get from env var | |
| 155 | 144 | ev := fmt.Sprintf("PUREGOTK_%s_PATH", name) | |
| 156 | 145 | if v := os.Getenv(ev); v != "" { | |
| @@ -210,11 +199,6 @@ func GoString(c uintptr) string { | |||
| 210 | 199 | // This is used when a package needs to load multiple shared libraries (e.g., GLIB needs both libgobject and libglib). | |
| 211 | 200 | // Returns a slice of full paths to all libraries for this package. | |
| 212 | 201 | func GetPaths(name string) []string { | |
| 213 | - | // resolve alias | |
| 214 | - | if v, ok := aliases[name]; ok { | |
| 215 | - | name = v | |
| 216 | - | } | |
| 217 | - | ||
| 218 | 202 | libNames, ok := names[name] | |
| 219 | 203 | if !ok || len(libNames) == 0 { | |
| 220 | 204 | // Fallback to single GetPath for backward compatibility | |
| @@ -53,13 +53,6 @@ var names = map[string][]string{ | |||||
| 53 | "PANGOCAIRO": {"libpangocairo-1.0.so"}, | 53 | "PANGOCAIRO": {"libpangocairo-1.0.so"}, | ||
| 54 | } | 54 | } | ||
| 55 | 55 | ||||
| 56 | - | // aliases are lib aliases | |||
| 57 | - | // for example when we load the GSK lib, we should get the functions from the GTK shared library | |||
| 58 | - | var aliases = map[string]string{ | |||
| 59 | - | "GSK": "GTK", | |||
| 60 | - | "GDK": "GTK", | |||
| 61 | - | } | |||
| 62 | - | ||||
| 63 | // pkgConfNames is a lookup from library names to pkg-config library names | 56 | // pkgConfNames is a lookup from library names to pkg-config library names | ||
| 64 | // This is populated dynamically via SetPackageName and has defaults for common libraries | 57 | // This is populated dynamically via SetPackageName and has defaults for common libraries | ||
| 65 | var pkgConfNames = map[string]string{ | 58 | var pkgConfNames = map[string]string{ | ||
| @@ -147,10 +140,6 @@ func findPkgConf(name string) string { | |||||
| 147 | // TODO: Hardcore a library shared object with linker -X flag | 140 | // TODO: Hardcore a library shared object with linker -X flag | ||
| 148 | // This is useful for packaging | 141 | // This is useful for packaging | ||
| 149 | func GetPath(name string) string { | 142 | func GetPath(name string) string { | ||
| 150 | - | // resolve alias | |||
| 151 | - | if v, ok := aliases[name]; ok { | |||
| 152 | - | name = v | |||
| 153 | - | } | |||
| 154 | // try to get from env var | 143 | // try to get from env var | ||
| 155 | ev := fmt.Sprintf("PUREGOTK_%s_PATH", name) | 144 | ev := fmt.Sprintf("PUREGOTK_%s_PATH", name) | ||
| 156 | if v := os.Getenv(ev); v != "" { | 145 | if v := os.Getenv(ev); v != "" { | ||
| @@ -210,11 +199,6 @@ func GoString(c uintptr) string { | |||||
| 210 | // This is used when a package needs to load multiple shared libraries (e.g., GLIB needs both libgobject and libglib). | 199 | // This is used when a package needs to load multiple shared libraries (e.g., GLIB needs both libgobject and libglib). | ||
| 211 | // Returns a slice of full paths to all libraries for this package. | 200 | // Returns a slice of full paths to all libraries for this package. | ||
| 212 | func GetPaths(name string) []string { | 201 | func GetPaths(name string) []string { | ||
| 213 | - | // resolve alias | |||
| 214 | - | if v, ok := aliases[name]; ok { | |||
| 215 | - | name = v | |||
| 216 | - | } | |||
| 217 | - | ||||
| 218 | libNames, ok := names[name] | 202 | libNames, ok := names[name] | ||
| 219 | if !ok || len(libNames) == 0 { | 203 | if !ok || len(libNames) == 0 { | ||
| 220 | // Fallback to single GetPath for backward compatibility | 204 | // Fallback to single GetPath for backward compatibility | ||
M internal/gir/pass/pass.go +13 -13
| @@ -387,7 +387,7 @@ func (p *Pass) writeGo(r types.Repository, gotemp *template.Template, dir string | |||
| 387 | 387 | ||
| 388 | 388 | var sharedLibraries []string | |
| 389 | 389 | if ns.SharedLibrary != "" { | |
| 390 | - | for _, lib := range libs := strings.Split(ns.SharedLibrary, ",") { | |
| 390 | + | for _, lib := range strings.Split(ns.SharedLibrary, ",") { | |
| 391 | 391 | if trimmed := strings.TrimSpace(lib); trimmed != "" { | |
| 392 | 392 | sharedLibraries = append(sharedLibraries, trimmed) | |
| 393 | 393 | } | |
| @@ -413,19 +413,19 @@ func (p *Pass) writeGo(r types.Repository, gotemp *template.Template, dir string | |||
| 413 | 413 | needsInit := (len(functions[fn]) + methods) > 0 | |
| 414 | 414 | ||
| 415 | 415 | args := types.TemplateArg{ | |
| 416 | - | PkgName: pkgName, | |
| 417 | - | PkgEnv: strings.ToUpper(pkgName), | |
| 418 | - | PkgConfigName: pkgConfigName, | |
| 416 | + | PkgName: pkgName, | |
| 417 | + | PkgEnv: strings.ToUpper(pkgName), | |
| 418 | + | PkgConfigName: pkgConfigName, | |
| 419 | 419 | SharedLibraries: sharedLibraries, | |
| 420 | - | NeedsInit: needsInit, | |
| 421 | - | Aliases: aliases[fn], | |
| 422 | - | Callbacks: callbacks[fn], | |
| 423 | - | Records: records[fn], | |
| 424 | - | Enums: enums[fn], | |
| 425 | - | Constants: constants[fn], | |
| 426 | - | Functions: functions[fn], | |
| 427 | - | Interfaces: interfaces[fn], | |
| 428 | - | Classes: classes[fn], | |
| 420 | + | NeedsInit: needsInit, | |
| 421 | + | Aliases: aliases[fn], | |
| 422 | + | Callbacks: callbacks[fn], | |
| 423 | + | Records: records[fn], | |
| 424 | + | Enums: enums[fn], | |
| 425 | + | Constants: constants[fn], | |
| 426 | + | Functions: functions[fn], | |
| 427 | + | Interfaces: interfaces[fn], | |
| 428 | + | Classes: classes[fn], | |
| 429 | 429 | } | |
| 430 | 430 | ||
| 431 | 431 | os.MkdirAll(fmt.Sprintf(dir+"/%s", pkgName), 0o755) | |
| @@ -387,7 +387,7 @@ func (p *Pass) writeGo(r types.Repository, gotemp *template.Template, dir string | |||||
| 387 | 387 | ||||
| 388 | var sharedLibraries []string | 388 | var sharedLibraries []string | ||
| 389 | if ns.SharedLibrary != "" { | 389 | if ns.SharedLibrary != "" { | ||
| 390 | - | for _, lib := range libs := strings.Split(ns.SharedLibrary, ",") { | 390 | + | for _, lib := range strings.Split(ns.SharedLibrary, ",") { |
| 391 | if trimmed := strings.TrimSpace(lib); trimmed != "" { | 391 | if trimmed := strings.TrimSpace(lib); trimmed != "" { | ||
| 392 | sharedLibraries = append(sharedLibraries, trimmed) | 392 | sharedLibraries = append(sharedLibraries, trimmed) | ||
| 393 | } | 393 | } | ||
| @@ -413,19 +413,19 @@ func (p *Pass) writeGo(r types.Repository, gotemp *template.Template, dir string | |||||
| 413 | needsInit := (len(functions[fn]) + methods) > 0 | 413 | needsInit := (len(functions[fn]) + methods) > 0 | ||
| 414 | 414 | ||||
| 415 | args := types.TemplateArg{ | 415 | args := types.TemplateArg{ | ||
| 416 | - | PkgName: pkgName, | 416 | + | PkgName: pkgName, |
| 417 | - | PkgEnv: strings.ToUpper(pkgName), | 417 | + | PkgEnv: strings.ToUpper(pkgName), |
| 418 | - | PkgConfigName: pkgConfigName, | 418 | + | PkgConfigName: pkgConfigName, |
| 419 | SharedLibraries: sharedLibraries, | 419 | SharedLibraries: sharedLibraries, | ||
| 420 | - | NeedsInit: needsInit, | 420 | + | NeedsInit: needsInit, |
| 421 | - | Aliases: aliases[fn], | 421 | + | Aliases: aliases[fn], |
| 422 | - | Callbacks: callbacks[fn], | 422 | + | Callbacks: callbacks[fn], |
| 423 | - | Records: records[fn], | 423 | + | Records: records[fn], |
| 424 | - | Enums: enums[fn], | 424 | + | Enums: enums[fn], |
| 425 | - | Constants: constants[fn], | 425 | + | Constants: constants[fn], |
| 426 | - | Functions: functions[fn], | 426 | + | Functions: functions[fn], |
| 427 | - | Interfaces: interfaces[fn], | 427 | + | Interfaces: interfaces[fn], |
| 428 | - | Classes: classes[fn], | 428 | + | Classes: classes[fn], |
| 429 | } | 429 | } | ||
| 430 | 430 | ||||
| 431 | os.MkdirAll(fmt.Sprintf(dir+"/%s", pkgName), 0o755) | 431 | os.MkdirAll(fmt.Sprintf(dir+"/%s", pkgName), 0o755) | ||