Skip to content

Commit f8e66fd

Browse files
committed
refactor: standardize library install path to lib directory
Remove all references to lib64 directory and enforce consistent lib directory usage: - Force CMAKE_INSTALL_LIBDIR=lib in CMake builds - Ensure Meson builds use --libdir=lib - Update pkg-config path to only include lib/pkgconfig - Modify FFmpeg and other build scripts to only reference lib directory - Update documentation to reflect the simplified directory structure This simplifies the build system and ensures more consistent library installation locations.
1 parent 2e93b0e commit f8e66fd

7 files changed

Lines changed: 9 additions & 16 deletions

File tree

docs/TODO.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ Build the project using `just build`. Using `just build` is the only valid way t
118118
├── etc
119119
├── include
120120
├── lib
121-
├── lib64
122121
├── share
123122
└── var
124123
```

internal/builder/buildsystems.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,11 @@ func (a *AutoconfBuild) Configure(lib *Library, srcPath, buildDir, installDir st
2525
if !lib.SkipAutoFlags {
2626
incDir := filepath.Join(installDir, "include")
2727
libDir := filepath.Join(installDir, "lib")
28-
lib64Dir := filepath.Join(installDir, "lib64")
2928

3029
args = append(args,
3130
fmt.Sprintf("CFLAGS=-I%s", incDir),
3231
fmt.Sprintf("CPPFLAGS=-I%s", incDir),
33-
fmt.Sprintf("LDFLAGS=-L%s -L%s", libDir, lib64Dir),
32+
fmt.Sprintf("LDFLAGS=-L%s", libDir),
3433
)
3534
}
3635

@@ -107,6 +106,7 @@ func (c *CMakeBuild) Configure(lib *Library, srcPath, buildDir, installDir strin
107106
actualSrcPath,
108107
fmt.Sprintf("-DCMAKE_INSTALL_PREFIX=%s", installDir),
109108
"-DCMAKE_BUILD_TYPE=Release",
109+
"-DCMAKE_INSTALL_LIBDIR=lib",
110110
}
111111

112112
if lib.ConfigureArgs != nil {
@@ -163,10 +163,9 @@ func (m *MesonBuild) Configure(lib *Library, srcPath, buildDir, installDir strin
163163
buildDir,
164164
srcPath,
165165
fmt.Sprintf("--prefix=%s", installDir),
166-
"--libdir=lib",
167-
"--pkgconfigdir=lib/pkgconfig",
168166
"--buildtype=release",
169167
"--default-library=static",
168+
"--libdir=lib",
170169
}
171170

172171
if lib.ConfigureArgs != nil {

internal/builder/libraries.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -705,12 +705,11 @@ var ffmpeg = &Library{
705705
stagingDir, _ := filepath.Abs(".build/staging")
706706
incDir := filepath.Join(stagingDir, "include")
707707
libDir := filepath.Join(stagingDir, "lib")
708-
lib64Dir := filepath.Join(stagingDir, "lib64")
709708

710709
args := []string{
711710
"--pkg-config-flags=--static",
712711
fmt.Sprintf("--extra-cflags=-I%s", incDir),
713-
fmt.Sprintf("--extra-ldflags=-L%s -L%s", libDir, lib64Dir),
712+
fmt.Sprintf("--extra-ldflags=-L%s", libDir),
714713
}
715714

716715
// Add common FFmpeg arguments (platform-specific)

internal/builder/library.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,7 @@ func fileExists(path string) bool {
170170

171171
// pkgConfigPath returns the PKG_CONFIG_PATH environment variable
172172
func pkgConfigPath(installDir string) string {
173-
// Include both lib and lib64 pkgconfig directories
174-
return filepath.Join(installDir, "lib", "pkgconfig") + ":" + filepath.Join(installDir, "lib64", "pkgconfig")
173+
return filepath.Join(installDir, "lib", "pkgconfig")
175174
}
176175

177176
// buildEnv returns environment variables for building

internal/builder/main.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ func main() {
5757
filepath.Join(buildRoot, "downloads"),
5858
filepath.Join(buildRoot, "build"),
5959
filepath.Join(stagingDir, "lib"),
60-
filepath.Join(stagingDir, "lib64"),
6160
filepath.Join(stagingDir, "include"),
6261
}
6362

@@ -94,7 +93,7 @@ func main() {
9493
// Also remove installed libraries from staging
9594
if lib.LinkLibs != nil {
9695
for _, libName := range lib.LinkLibs {
97-
for _, dir := range []string{"lib", "lib64"} {
96+
for _, dir := range []string{"lib"} {
9897
libPath := filepath.Join(stagingDir, dir, libName+".a")
9998
if fileExists(libPath) {
10099
os.Remove(libPath)
@@ -171,10 +170,9 @@ func combineLibraries(libs []*Library, stagingDir, output string) error {
171170
}
172171
}
173172

174-
// Search for the specific .a files in lib and lib64
173+
// Search for the specific .a files in lib
175174
libDirs := []string{
176175
filepath.Join(stagingDir, "lib"),
177-
filepath.Join(stagingDir, "lib64"),
178176
}
179177

180178
for _, libDir := range libDirs {

internal/builder/state.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,7 @@ func (s *BuildState) CanSkip(installDir string) bool {
8888
}
8989

9090
// For libraries with LinkLibs, check that all expected .a files exist
91-
// Try both lib and lib64 directories (CMake may use either)
92-
for _, dir := range []string{"lib", "lib64"} {
91+
for _, dir := range []string{"lib"} {
9392
libDir := filepath.Join(installDir, dir)
9493
allFound := true
9594
for _, libName := range s.lib.LinkLibs {

justfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ default:
44

55
# Clean build artifacts and downloads
66
clean:
7-
@rm -rf .build/ 2>/dev/null || true
7+
@rm -rf .build/{build,src,staging} 2>/dev/null || true
88
@rm examples/asciiplayer/asciiplayer 2>/dev/null || true
99
@rm examples/introspect/introspect 2>/dev/null || true
1010
@rm examples/metadata/metadata 2>/dev/null || true

0 commit comments

Comments
 (0)